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 /src/bin/cli/mod.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 'src/bin/cli/mod.rs')
-rw-r--r-- | src/bin/cli/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bin/cli/mod.rs b/src/bin/cli/mod.rs index 4e15efb..dacf9b6 100644 --- a/src/bin/cli/mod.rs +++ b/src/bin/cli/mod.rs @@ -97,7 +97,7 @@ impl TryFrom<&mut Document> for Metadata { impl Metadata { fn write_list(v: &[String], prefix: &str) { - v.iter().for_each(|entry| println!("{}: {}", prefix, entry)) + v.iter().for_each(|entry| println!("{prefix}: {entry}")) } pub fn write_out(&self) { @@ -107,7 +107,7 @@ impl Metadata { let templates: Vec<String> = self.impls.keys().map(String::from).collect(); Self::write_list(&templates, "templates"); for (template, filenames) in self.impls.iter() { - Self::write_list(filenames, &format!("functions[{}]", template)); + Self::write_list(filenames, &format!("functions[{template}]")); } Self::write_list(&self.bibliographies, "bibliography"); Self::write_list(&self.files, "file"); @@ -139,7 +139,7 @@ impl FromStr for OutputFormat { match s.to_ascii_lowercase().as_ref() { "plain" => Ok(OutputFormat::Plain), "json" => Ok(OutputFormat::Json), - _ => Err(format!("Unknown output format: `{}`", s)), + _ => Err(format!("Unknown output format: `{s}`")), } } } |