diff options
author | Lars Wirzenius <liw@liw.fi> | 2023-02-11 14:33:17 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2023-02-11 14:33:17 +0200 |
commit | 78325817028096ca134b7c2bbd3bc6ca000a8f3e (patch) | |
tree | b373d1d9d781f16825bc91748978b5b49ac36879 /build.rs | |
parent | b6df0fa5b7046bad97f63dc928a9776cecaee623 (diff) | |
download | subplot-78325817028096ca134b7c2bbd3bc6ca000a8f3e.tar.gz |
chore: use variables in Rust format strings
Change this:
format!("{}", foo)
into this:
format!("{foo}")
Support for this feature was added in Rust 1.58 (see
https://github.com/rust-lang/rust/releases/tag/1.58.0) and in 1.67
clippy suggests about this. Because the new style seems to be where
the Rust ecosystem is going, I think Subplot should follow to avoid
being needlessly different from most other projects.
Sponsored-by: author
Diffstat (limited to 'build.rs')
-rw-r--r-- | build.rs | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -127,15 +127,11 @@ fn write_out_resource_file<'a>(paths: impl Iterator<Item = &'a Path>) -> Result< /// to contain `BUILTIN_{var}` to either the env value, or `{def}` if not /// provided. fn adopt_env_var(var: &str, def: &str) { - println!("cargo:rerun-if-env-changed=SUBPLOT_{var}", var = var); - if let Ok(value) = std::env::var(format!("SUBPLOT_{var}", var = var)) { - println!( - "cargo:rustc-env=BUILTIN_{var}={value}", - var = var, - value = value - ); + println!("cargo:rerun-if-env-changed=SUBPLOT_{var}"); + if let Ok(value) = std::env::var(format!("SUBPLOT_{var}")) { + println!("cargo:rustc-env=BUILTIN_{var}={value}",); } else { - println!("cargo:rustc-env=BUILTIN_{var}={def}", var = var, def = def); + println!("cargo:rustc-env=BUILTIN_{var}={def}"); } } |