Skip to content

Commit

Permalink
CheckContext -> &CheckContext
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Nov 27, 2020
1 parent 3d27514 commit ca8ac63
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## NEXT (UNRELEASED)

#### Changed

* `walk_dir` now takes `&CheckContext`, not `CheckContext`. [PR#118]

[PR#118]: https://github.com/deadlinks/cargo-deadlinks/pull/118

<a name="0.6.2"></a>
## 0.6.2 (2020-11-27)

Expand Down
2 changes: 1 addition & 1 deletion src/bin/cargo-deadlinks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn main() {
}
};
log::info!("checking directory {:?}", dir);
if walk_dir(&dir, ctx.clone()) {
if walk_dir(&dir, &ctx) {
errors = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/bin/deadlinks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn main() {
}
};
log::info!("checking directory {:?}", dir);
errors |= walk_dir(&dir, ctx.clone());
errors |= walk_dir(&dir, &ctx);
}
if errors {
process::exit(1);
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ impl fmt::Display for FileError {
///
/// For each error that occurred, print an error message.
/// Returns whether an error occurred.
pub fn walk_dir(dir_path: &Path, ctx: CheckContext) -> bool {
pub fn walk_dir(dir_path: &Path, ctx: &CheckContext) -> bool {
let pool = ThreadPoolBuilder::new()
.num_threads(num_cpus::get())
.build()
.unwrap();

pool.install(|| {
unavailable_urls(dir_path, &ctx)
unavailable_urls(dir_path, ctx)
.map(|err| {
if ctx.verbose {
println!("{}", err);
Expand Down

0 comments on commit ca8ac63

Please sign in to comment.