mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-19 01:50:32 +00:00
Inline all format arguments where possible
This makes code more readale and concise, moving all format arguments like `format!("{}", foo)` into the more compact `format!("{foo}")` form. The change was automatically created with, so there are far less change of an accidental typo. ``` cargo clippy --fix -- -A clippy::all -W clippy::uninlined_format_args ```
This commit is contained in:
parent
1927c2e1d8
commit
e16c76e3c3
180 changed files with 487 additions and 501 deletions
|
@ -295,7 +295,7 @@ impl WorkspaceBuildScripts {
|
|||
match message {
|
||||
Message::BuildScriptExecuted(mut message) => {
|
||||
with_output_for(&message.package_id.repr, &mut |name, data| {
|
||||
progress(format!("running build-script: {}", name));
|
||||
progress(format!("running build-script: {name}"));
|
||||
let cfgs = {
|
||||
let mut acc = Vec::new();
|
||||
for cfg in &message.cfgs {
|
||||
|
@ -334,7 +334,7 @@ impl WorkspaceBuildScripts {
|
|||
}
|
||||
Message::CompilerArtifact(message) => {
|
||||
with_output_for(&message.package_id.repr, &mut |name, data| {
|
||||
progress(format!("building proc-macros: {}", name));
|
||||
progress(format!("building proc-macros: {name}"));
|
||||
if message.target.kind.iter().any(|k| k == "proc-macro") {
|
||||
// Skip rmeta file
|
||||
if let Some(filename) =
|
||||
|
|
|
@ -17,7 +17,7 @@ impl FromStr for CfgFlag {
|
|||
let res = match s.split_once('=') {
|
||||
Some((key, value)) => {
|
||||
if !(value.starts_with('"') && value.ends_with('"')) {
|
||||
return Err(format!("Invalid cfg ({:?}), value should be in quotes", s));
|
||||
return Err(format!("Invalid cfg ({s:?}), value should be in quotes"));
|
||||
}
|
||||
let key = key.to_string();
|
||||
let value = value[1..value.len() - 1].to_string();
|
||||
|
|
|
@ -146,7 +146,7 @@ impl ProjectManifest {
|
|||
}
|
||||
|
||||
fn utf8_stdout(mut cmd: Command) -> Result<String> {
|
||||
let output = cmd.output().with_context(|| format!("{:?} failed", cmd))?;
|
||||
let output = cmd.output().with_context(|| format!("{cmd:?} failed"))?;
|
||||
if !output.status.success() {
|
||||
match String::from_utf8(output.stderr) {
|
||||
Ok(stderr) if !stderr.is_empty() => {
|
||||
|
|
|
@ -197,5 +197,5 @@ where
|
|||
D: de::Deserializer<'de>,
|
||||
{
|
||||
let name = String::deserialize(de)?;
|
||||
CrateName::new(&name).map_err(|err| de::Error::custom(format!("invalid crate name: {:?}", err)))
|
||||
CrateName::new(&name).map_err(|err| de::Error::custom(format!("invalid crate name: {err:?}")))
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ impl Sysroot {
|
|||
|
||||
for path in SYSROOT_CRATES.trim().lines() {
|
||||
let name = path.split('/').last().unwrap();
|
||||
let root = [format!("{}/src/lib.rs", path), format!("lib{}/lib.rs", path)]
|
||||
let root = [format!("{path}/src/lib.rs"), format!("lib{path}/lib.rs")]
|
||||
.into_iter()
|
||||
.map(|it| sysroot.src_root.join(it))
|
||||
.filter_map(|it| ManifestPath::try_from(it).ok())
|
||||
|
|
|
@ -107,7 +107,7 @@ fn to_crate_graph(project_workspace: ProjectWorkspace) -> CrateGraph {
|
|||
}
|
||||
|
||||
fn check_crate_graph(crate_graph: CrateGraph, expect: Expect) {
|
||||
let mut crate_graph = format!("{:#?}", crate_graph);
|
||||
let mut crate_graph = format!("{crate_graph:#?}");
|
||||
replace_root(&mut crate_graph, false);
|
||||
expect.assert_eq(&crate_graph);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue