diff --git a/build.rs b/build.rs index add123a..51eadef 100644 --- a/build.rs +++ b/build.rs @@ -26,7 +26,7 @@ fn main() { let hash_path = Path::new(&out_dir).join("style.css.sha1"); let digest = Sha1::digest(style.as_bytes()); - fs::write(hash_path, format!("{:x}", digest)).unwrap(); + fs::write(hash_path, format!("{digest:x}")).unwrap(); // hash and copy the JS file let js_blob = fs::read("./assets/links.js").unwrap(); @@ -35,5 +35,5 @@ fn main() { let js_hash_path = Path::new(&out_dir).join("links.js.sha1"); let js_digest = Sha1::digest(&js_blob); - fs::write(js_hash_path, format!("{:x}", js_digest)).unwrap(); + fs::write(js_hash_path, format!("{js_digest:x}")).unwrap(); } diff --git a/src/interactors/crates.rs b/src/interactors/crates.rs index 6c04747..e490a64 100644 --- a/src/interactors/crates.rs +++ b/src/interactors/crates.rs @@ -132,7 +132,7 @@ impl GetPopularCrates { } pub async fn query(client: reqwest::Client) -> anyhow::Result> { - let url = format!("{}/summary", CRATES_API_BASE_URI); + let url = format!("{CRATES_API_BASE_URI}/summary"); let res = client.get(&url).send().await?.error_for_status()?; let summary: SummaryResponse = res.json().await?; diff --git a/src/interactors/github.rs b/src/interactors/github.rs index 6f6687e..32d5c86 100644 --- a/src/interactors/github.rs +++ b/src/interactors/github.rs @@ -44,10 +44,7 @@ impl GetPopularRepos { } pub async fn query(client: reqwest::Client) -> anyhow::Result> { - let url = format!( - "{}/search/repositories?q=language:rust&sort=stars", - GITHUB_API_BASE_URI - ); + let url = format!("{GITHUB_API_BASE_URI}/search/repositories?q=language:rust&sort=stars"); let res = client.get(&url).send().await?.error_for_status()?; let summary: GithubSearchResponse = res.json().await?; diff --git a/src/models/repo.rs b/src/models/repo.rs index 98fc6c5..3e63db8 100644 --- a/src/models/repo.rs +++ b/src/models/repo.rs @@ -224,10 +224,7 @@ mod tests { let repo = RepoPath::from_parts("github", "deps-rs", "deps.rs").unwrap(); let out = repo.to_usercontent_file_url(RelativePath::new(input)); - let exp = format!( - "https://raw.githubusercontent.com/deps-rs/deps.rs/HEAD/{}", - expected - ); + let exp = format!("https://raw.githubusercontent.com/deps-rs/deps.rs/HEAD/{expected}"); assert_eq!(out.to_string(), exp); } @@ -235,7 +232,7 @@ mod tests { let repo = RepoPath::from_parts("gitlab", "deps-rs", "deps.rs").unwrap(); let out = repo.to_usercontent_file_url(RelativePath::new(input)); - let exp = format!("https://gitlab.com/deps-rs/deps.rs/raw/HEAD/{}", expected); + let exp = format!("https://gitlab.com/deps-rs/deps.rs/raw/HEAD/{expected}"); assert_eq!(out.to_string(), exp); } @@ -243,10 +240,7 @@ mod tests { let repo = RepoPath::from_parts("bitbucket", "deps-rs", "deps.rs").unwrap(); let out = repo.to_usercontent_file_url(RelativePath::new(input)); - let exp = format!( - "https://bitbucket.org/deps-rs/deps.rs/raw/HEAD/{}", - expected - ); + let exp = format!("https://bitbucket.org/deps-rs/deps.rs/raw/HEAD/{expected}"); assert_eq!(out.to_string(), exp); } @@ -254,7 +248,7 @@ mod tests { let repo = RepoPath::from_parts("codeberg", "deps-rs", "deps.rs").unwrap(); let out = repo.to_usercontent_file_url(RelativePath::new(input)); - let exp = format!("https://codeberg.org/deps-rs/deps.rs/raw/{}", expected); + let exp = format!("https://codeberg.org/deps-rs/deps.rs/raw/{expected}"); assert_eq!(out.to_string(), exp); } @@ -262,7 +256,7 @@ mod tests { let repo = RepoPath::from_parts("gitea/gitea.com", "deps-rs", "deps.rs").unwrap(); let out = repo.to_usercontent_file_url(RelativePath::new(input)); - let exp = format!("https://gitea.com/deps-rs/deps.rs/raw/{}", expected); + let exp = format!("https://gitea.com/deps-rs/deps.rs/raw/{expected}"); assert_eq!(out.to_string(), exp); } @@ -270,7 +264,7 @@ mod tests { let repo = RepoPath::from_parts("gitea/example.com/git", "deps-rs", "deps.rs").unwrap(); let out = repo.to_usercontent_file_url(RelativePath::new(input)); - let exp = format!("https://example.com/git/deps-rs/deps.rs/raw/{}", expected); + let exp = format!("https://example.com/git/deps-rs/deps.rs/raw/{expected}"); assert_eq!(out.to_string(), exp); } } diff --git a/src/server/views/badge.rs b/src/server/views/badge.rs index 270071e..0ee55c5 100644 --- a/src/server/views/badge.rs +++ b/src/server/views/badge.rs @@ -31,7 +31,7 @@ pub fn badge( if outdated > 0 { BadgeOptions { subject, - status: format!("{} of {} outdated", outdated, total), + status: format!("{outdated} of {total} outdated"), color: "#dfb317".into(), style: badge_knobs.style, } diff --git a/src/server/views/html/mod.rs b/src/server/views/html/mod.rs index 6d2b549..2f3457b 100644 --- a/src/server/views/html/mod.rs +++ b/src/server/views/html/mod.rs @@ -18,7 +18,7 @@ fn render_html(title: &str, body: B) -> Response { head { meta charset="utf-8"; meta name="viewport" content="width=device-width, initial-scale=1"; - title { (format!("{} - Deps.rs", title)) } + title { (format!("{title} - Deps.rs")) } link rel="icon" type="image/svg+xml" href="/static/logo.svg"; link rel="stylesheet" type="text/css" href=(STATIC_STYLE_CSS_PATH); link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Fira+Sans:400,500,600"; @@ -67,7 +67,7 @@ fn render_footer(duration: Option) -> Markup { "." } @if let Some(millis) = duration_millis { - p class="has-text-grey is-size-7" { (format!("(rendered in {} ms)", millis)) } + p class="has-text-grey is-size-7" { (format!("(rendered in {millis} ms)")) } } } } diff --git a/src/server/views/html/status.rs b/src/server/views/html/status.rs index 721acc6..19c0d23 100644 --- a/src/server/views/html/status.rs +++ b/src/server/views/html/status.rs @@ -61,14 +61,14 @@ fn dependency_table(title: &str, deps: &IndexMap) h3 class="title is-4" { (title) } p class="subtitle is-5" { (match (count_outdated, count_always_insecure, count_insecure - count_always_insecure) { - (0, 0, 0) => format!("({} total, all up-to-date)", count_total), - (0, 0, c) => format!("({} total, {} possibly insecure)", count_total, c), - (_, 0, 0) => format!("({} total, {} outdated)", count_total, count_outdated), - (0, _, 0) => format!("({} total, {} insecure)", count_total, count_always_insecure), - (0, _, c) => format!("({} total, {} insecure, {} possibly insecure)", count_total, count_always_insecure, c), - (_, 0, c) => format!("({} total, {} outdated, {} possibly insecure)", count_total, count_outdated, c), - (_, _, 0) => format!("({} total, {} outdated, {} insecure)", count_total, count_outdated, count_always_insecure), - (_, _, c) => format!("({} total, {} outdated, {} insecure, {} possibly insecure)", count_total, count_outdated, count_always_insecure, c), + (0, 0, 0) => format!("({count_total} total, all up-to-date)"), + (0, 0, c) => format!("({count_total} total, {c} possibly insecure)"), + (_, 0, 0) => format!("({count_total} total, {count_outdated} outdated)"), + (0, _, 0) => format!("({count_total} total, {count_always_insecure} insecure)"), + (0, _, c) => format!("({count_total} total, {count_always_insecure} insecure, {c} possibly insecure)"), + (_, 0, c) => format!("({count_total} total, {count_outdated} outdated, {c} possibly insecure)"), + (_, _, 0) => format!("({count_total} total, {count_outdated} outdated, {count_always_insecure} insecure)"), + (_, _, c) => format!("({count_total} total, {count_outdated} outdated, {count_always_insecure} insecure, {c} possibly insecure)"), }) } @@ -385,7 +385,7 @@ fn render_success( .unwrap(); html! { - section class=(format!("hero {}", hero_class)) { + section class=(format!("hero {hero_class}")) { div class="hero-head" { (super::render_navbar()) } div class="hero-body" { div class="container" { @@ -406,9 +406,9 @@ fn render_success( div class="container" { pre class="is-size-7" { @if extra_config.path.is_some() { - (format!("[![dependency status]({}/status.svg?{opt})]({}?{opt})", status_base_url, status_base_url, opt = options)) + (format!("[![dependency status]({status_base_url}/status.svg?{options})]({status_base_url}?{options})")) } @else { - (format!("[![dependency status]({}/status.svg)]({})", status_base_url, status_base_url)) + (format!("[![dependency status]({status_base_url}/status.svg)]({status_base_url})")) } } }