Fix Rust 1.66 clippy lints (#879)

This commit is contained in:
Matthias Endler 2022-12-19 14:28:10 +01:00 committed by GitHub
parent f0d5f64cf6
commit 6df1c378ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 18 deletions

View file

@ -221,7 +221,7 @@ fn show_progress(
} else if verbose.is_verbose()
|| (!response.status().is_success() && !response.status().is_excluded())
{
writeln!(output, "{}", out)?;
writeln!(output, "{out}")?;
}
Ok(())
}

View file

@ -102,5 +102,5 @@ fn write(
}
fn write_out(writer: &mut Box<dyn Write>, out_str: &str) -> io::Result<()> {
writeln!(writer, "{}", out_str)
writeln!(writer, "{out_str}")
}

View file

@ -38,13 +38,13 @@ impl fmt::Display for Duration {
let seconds = self.elapsed % 60;
if days > 0 {
write!(f, "{}d {}h {}m {}s", days, hours, minutes, seconds)
write!(f, "{days}d {hours}h {minutes}m {seconds}s")
} else if hours > 0 {
write!(f, "{}h {}m {}s", hours, minutes, seconds)
write!(f, "{hours}h {minutes}m {seconds}s")
} else if minutes > 0 {
write!(f, "{}m {}s", minutes, seconds)
write!(f, "{minutes}m {seconds}s")
} else {
write!(f, "{}s", seconds)
write!(f, "{seconds}s")
}
}
}

View file

@ -30,7 +30,7 @@ impl Display for DetailedResponseStats {
let separator = "-".repeat(MAX_PADDING + 1);
writeln!(f, "\u{1f4dd} Summary")?; // 📝
writeln!(f, "{}", separator)?;
writeln!(f, "{separator}")?;
write_stat(f, "\u{1f50d} Total", stats.total, true)?; // 🔍
write_stat(f, "\u{2705} Successful", stats.successful, true)?; // ✅
write_stat(f, "\u{23f3} Timeouts", stats.timeouts, true)?; // ⏳

View file

@ -100,7 +100,7 @@ impl Display for MarkdownResponseStats {
for (source, responses) in &stats.fail_map {
// Using leading newlines over trailing ones (e.g. `writeln!`)
// lets us avoid extra newlines without any additional logic.
writeln!(f, "### Errors in {}\n", source)?;
writeln!(f, "### Errors in {source}\n")?;
for response in responses {
writeln!(
f,

View file

@ -20,7 +20,7 @@ mod cli {
writeln!(index, r#"<a href="./foo.html">Foo</a>"#)?;
let foo_path = dir.path().join("foo.html");
File::create(&foo_path)?;
File::create(foo_path)?;
let mut cmd = main_command();
cmd.arg(index_path)
@ -39,14 +39,14 @@ mod cli {
async fn test_local_dir() -> Result<()> {
let dir = tempfile::tempdir()?;
let index_path = dir.path().join("index.html");
let mut index = File::create(&index_path)?;
let mut index = File::create(index_path)?;
writeln!(index, r#"<a href="./foo.html">Foo</a>"#)?;
writeln!(index, r#"<a href="./bar.md">Bar</a>"#)?;
let foo_path = dir.path().join("foo.html");
File::create(&foo_path)?;
File::create(foo_path)?;
let bar_path = dir.path().join("bar.md");
File::create(&bar_path)?;
File::create(bar_path)?;
let mut cmd = main_command();
cmd.arg(dir.path())

View file

@ -512,7 +512,7 @@ impl Client {
// now we find that this public repo is reachable through the API,
// so that must mean the full URI (which includes the additional
// endpoint) must be invalid.
return ErrorKind::InvalidGithubUrl(format!("{}/{}/{}", uri.owner, uri.repo, endpoint))
return ErrorKind::InvalidGithubUrl(format!("{}/{}/{endpoint}", uri.owner, uri.repo))
.into();
}
// Found public repo without endpoint

View file

@ -146,9 +146,9 @@ mod tests {
let mut file_glob_1 = File::create(file_glob_1_path).unwrap();
let mut file_glob_2 = File::create(file_glob_2_path).unwrap();
writeln!(file, "{}", TEST_FILE).unwrap();
writeln!(file_glob_1, "{}", TEST_GLOB_1).unwrap();
writeln!(file_glob_2, "{}", TEST_GLOB_2_MAIL).unwrap();
writeln!(file, "{TEST_FILE}").unwrap();
writeln!(file_glob_1, "{TEST_GLOB_1}").unwrap();
writeln!(file_glob_2, "{TEST_GLOB_2_MAIL}").unwrap();
let mock_server = mock_server!(StatusCode::OK, set_body_string(TEST_URL));

View file

@ -44,7 +44,7 @@ impl Base {
// We can probably use the original URL and just replace the
// path component in the caller of this function
if let Some(port) = url.port() {
Url::parse(&format!("{}://{}:{}", url.scheme(), url.host_str()?, port)).ok()
Url::parse(&format!("{}://{}:{port}", url.scheme(), url.host_str()?)).ok()
} else {
Url::parse(&format!("{}://{}", url.scheme(), url.host_str()?)).ok()
}

View file

@ -77,7 +77,7 @@ impl Display for ResponseBody {
write!(f, " | {}", self.status)?;
if let Some(details) = self.status.details() {
write!(f, ": {}", details)
write!(f, ": {details}")
} else {
Ok(())
}