Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jyn514 committed Nov 27, 2022
1 parent 2fb1be6 commit de40613
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/bin/cargo-deadlinks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ fn determine_dir(
.packages
.into_iter()
.filter(|package| package.source.is_none())
.map(|package| package.targets)
.flatten()
.flat_map(|package| package.targets)
.filter(has_docs)
.map(move |target| doc.join(target.name.replace('-', "_")));
return iter.collect();
Expand All @@ -214,6 +213,7 @@ fn determine_dir(
});
// Stolen from https://docs.rs/cargo_metadata/0.12.0/cargo_metadata/#examples
let mut cargo_process = Command::new(cargo);
#[allow(clippy::needless_borrow)] // MSRV is 1.46
cargo_process
.args(&[
"doc",
Expand Down
5 changes: 3 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
//! <https://tinyurl.com/rnxcavf>
#![allow(clippy::result_large_err)]

use std::{
fmt,
path::{Path, PathBuf},
Expand Down Expand Up @@ -95,7 +96,7 @@ impl FileError {
fn shorten_all(&mut self, prefix: &Path) {
use check::Link;

if let Ok(shortened) = self.path.strip_prefix(&prefix) {
if let Ok(shortened) = self.path.strip_prefix(prefix) {
self.path = shortened.to_path_buf();
};
for mut e in &mut self.errors {
Expand Down
2 changes: 1 addition & 1 deletion tests/non_existent_http_link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ mod non_existent_http_link {
// fails with --check-http flag
Command::cargo_bin("cargo-deadlinks")
.unwrap()
.args(&["deadlinks", "--check-http"])
.args(["deadlinks", "--check-http"])
.current_dir("./tests/non_existent_http_link")
.assert()
.failure()
Expand Down
6 changes: 3 additions & 3 deletions tests/working_http_check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ mod working_http_check {
use super::*;

fn remove_target(relative_path: &'static str) {
match std::fs::remove_dir_all(&format!("./tests/working_http_check/{}", relative_path)) {
match std::fs::remove_dir_all(format!("./tests/working_http_check/{}", relative_path)) {
Ok(_) => {}
Err(err) => match err.kind() {
std::io::ErrorKind::NotFound => {}
Expand All @@ -34,7 +34,7 @@ mod working_http_check {
// succeeds with --check-http flag
Command::cargo_bin("cargo-deadlinks")
.unwrap()
.args(&["deadlinks", "--check-http"])
.args(["deadlinks", "--check-http"])
.current_dir("./tests/working_http_check")
.assert()
.success();
Expand All @@ -45,7 +45,7 @@ mod working_http_check {
remove_target("target2");
Command::cargo_bin("cargo-deadlinks")
.unwrap()
.args(&[
.args([
"deadlinks",
"--forbid-http",
"--",
Expand Down

0 comments on commit de40613

Please sign in to comment.