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:
Yuri Astrakhan 2022-12-23 13:42:58 -05:00
parent 1927c2e1d8
commit e16c76e3c3
180 changed files with 487 additions and 501 deletions

View file

@ -81,9 +81,9 @@ impl Logger {
Registry::default()
.with(
self.filter
.add_directive(format!("chalk_solve={}", val).parse()?)
.add_directive(format!("chalk_ir={}", val).parse()?)
.add_directive(format!("chalk_recursive={}", val).parse()?),
.add_directive(format!("chalk_solve={val}").parse()?)
.add_directive(format!("chalk_ir={val}").parse()?)
.add_directive(format!("chalk_recursive={val}").parse()?),
)
.with(ra_fmt_layer)
.with(chalk_layer)
@ -124,7 +124,7 @@ where
Some(log) => log.target(),
None => event.metadata().target(),
};
write!(writer, "[{} {}] ", level, target)?;
write!(writer, "[{level} {target}] ")?;
// Write spans and fields of each span
ctx.visit_spans(|span| {
@ -140,7 +140,7 @@ where
let fields = &ext.get::<FormattedFields<N>>().expect("will never be `None`");
if !fields.is_empty() {
write!(writer, "{{{}}}", fields)?;
write!(writer, "{{{fields}}}")?;
}
write!(writer, ": ")?;

View file

@ -30,7 +30,7 @@ fn main() {
let code = match rustc_wrapper::run_rustc_skipping_cargo_checking(rustc, args.collect()) {
Ok(rustc_wrapper::ExitCode(code)) => code.unwrap_or(102),
Err(err) => {
eprintln!("{}", err);
eprintln!("{err}");
101
}
};
@ -40,7 +40,7 @@ fn main() {
let flags = flags::RustAnalyzer::from_env_or_exit();
if let Err(err) = try_main(flags) {
tracing::error!("Unexpected error: {}", err);
eprintln!("{}", err);
eprintln!("{err}");
process::exit(101);
}
}

View file

@ -46,7 +46,7 @@ fn report_metric(metric: &str, value: u64, unit: &str) {
if std::env::var("RA_METRICS").is_err() {
return;
}
println!("METRIC:{}:{}:{}", metric, value, unit)
println!("METRIC:{metric}:{value}:{unit}")
}
fn print_memory_usage(mut host: AnalysisHost, vfs: Vfs) {
@ -65,6 +65,6 @@ fn print_memory_usage(mut host: AnalysisHost, vfs: Vfs) {
for (name, bytes) in mem {
// NOTE: Not a debug print, so avoid going through the `eprintln` defined above.
eprintln!("{:>8} {}", bytes, name);
eprintln!("{bytes:>8} {name}");
}
}

View file

@ -87,9 +87,9 @@ impl flags::AnalysisStats {
load_workspace(workspace, &cargo_config.extra_env, &load_cargo_config)?;
let db = host.raw_database();
eprint!("{:<20} {}", "Database loaded:", db_load_sw.elapsed());
eprint!(" (metadata {}", metadata_time);
eprint!(" (metadata {metadata_time}");
if let Some(build_scripts_time) = build_scripts_time {
eprint!("; build {}", build_scripts_time);
eprint!("; build {build_scripts_time}");
}
eprintln!(")");
@ -118,7 +118,7 @@ impl flags::AnalysisStats {
shuffle(&mut rng, &mut visit_queue);
}
eprint!(" crates: {}", num_crates);
eprint!(" crates: {num_crates}");
let mut num_decls = 0;
let mut funcs = Vec::new();
while let Some(module) = visit_queue.pop() {
@ -142,7 +142,7 @@ impl flags::AnalysisStats {
}
}
}
eprintln!(", mods: {}, decls: {}, fns: {}", visited_modules.len(), num_decls, funcs.len());
eprintln!(", mods: {}, decls: {num_decls}, fns: {}", visited_modules.len(), funcs.len());
eprintln!("{:<20} {}", "Item Collection:", analysis_sw.elapsed());
if self.randomize {
@ -154,7 +154,7 @@ impl flags::AnalysisStats {
}
let total_span = analysis_sw.elapsed();
eprintln!("{:<20} {}", "Total:", total_span);
eprintln!("{:<20} {total_span}", "Total:");
report_metric("total time", total_span.time.as_millis() as u64, "ms");
if let Some(instructions) = total_span.instructions {
report_metric("total instructions", instructions, "#instr");
@ -179,7 +179,7 @@ impl flags::AnalysisStats {
total_macro_file_size += syntax_len(val.syntax_node())
}
}
eprintln!("source files: {}, macro files: {}", total_file_size, total_macro_file_size);
eprintln!("source files: {total_file_size}, macro files: {total_macro_file_size}");
}
if self.memory_usage && verbosity.is_verbose() {
@ -239,7 +239,7 @@ impl flags::AnalysisStats {
continue;
}
}
let mut msg = format!("processing: {}", full_name);
let mut msg = format!("processing: {full_name}");
if verbosity.is_verbose() {
if let Some(src) = f.source(db) {
let original_file = src.file_id.original_file(db);
@ -275,7 +275,7 @@ impl flags::AnalysisStats {
end.col,
));
} else {
bar.println(format!("{}: Unknown type", name,));
bar.println(format!("{name}: Unknown type",));
}
}
true
@ -402,7 +402,7 @@ fn location_csv(
let text_range = original_range.range;
let (start, end) =
(line_index.line_col(text_range.start()), line_index.line_col(text_range.end()));
format!("{},{}:{},{}:{}", path, start.line + 1, start.col, end.line + 1, end.col)
format!("{path},{}:{},{}:{}", start.line + 1, start.col, end.line + 1, end.col)
}
fn expr_syntax_range(

View file

@ -40,7 +40,7 @@ impl flags::Diagnostics {
if !visited_files.contains(&file_id) {
let crate_name =
module.krate().display_name(db).as_deref().unwrap_or("unknown").to_string();
println!("processing crate: {}, module: {}", crate_name, _vfs.file_path(file_id));
println!("processing crate: {crate_name}, module: {}", _vfs.file_path(file_id));
for diagnostic in analysis
.diagnostics(
&DiagnosticsConfig::test_sample(),
@ -53,7 +53,7 @@ impl flags::Diagnostics {
found_error = true;
}
println!("{:?}", diagnostic);
println!("{diagnostic:?}");
}
visited_files.insert(file_id);

View file

@ -255,7 +255,7 @@ impl FromStr for OutputFormat {
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"csv" => Ok(Self::Csv),
_ => Err(format!("unknown output format `{}`", s)),
_ => Err(format!("unknown output format `{s}`")),
}
}
}

View file

@ -8,7 +8,7 @@ impl flags::Highlight {
pub fn run(self) -> anyhow::Result<()> {
let (analysis, file_id) = Analysis::from_single_file(read_stdin()?);
let html = analysis.highlight_as_html(file_id, self.rainbow).unwrap();
println!("{}", html);
println!("{html}");
Ok(())
}
}

View file

@ -83,7 +83,7 @@ impl LsifManager<'_> {
// FIXME: support file in addition to stdout here
fn emit(&self, data: &str) {
println!("{}", data);
println!("{data}");
}
fn get_token_id(&mut self, id: TokenId) -> Id {

View file

@ -67,7 +67,7 @@ impl ProgressReport {
return;
}
let percent = (self.curr * 100.0) as u32;
let text = format!("{}/{} {:3>}% {}", self.pos, self.len, percent, self.msg);
let text = format!("{}/{} {percent:3>}% {}", self.pos, self.len, self.msg);
self.update_text(&text);
}
@ -114,7 +114,7 @@ impl ProgressReport {
// Fill all last text to space and return the cursor
let spaces = " ".repeat(self.text.len());
let backspaces = "\x08".repeat(self.text.len());
print!("{}{}{}", backspaces, spaces, backspaces);
print!("{backspaces}{spaces}{backspaces}");
let _ = io::stdout().flush();
self.text = String::new();

View file

@ -28,7 +28,7 @@ impl flags::Scip {
let now = Instant::now();
let cargo_config = CargoConfig::default();
let no_progress = &|s| (eprintln!("rust-analyzer: Loading {}", s));
let no_progress = &|s| (eprintln!("rust-analyzer: Loading {s}"));
let load_cargo_config = LoadCargoConfig {
load_out_dirs_from_check: true,
with_proc_macro: true,
@ -209,7 +209,7 @@ fn new_descriptor_str(
fn new_descriptor(name: Name, suffix: scip_types::descriptor::Suffix) -> scip_types::Descriptor {
let mut name = name.to_string();
if name.contains("'") {
name = format!("`{}`", name);
name = format!("`{name}`");
}
new_descriptor_str(name.as_str(), suffix)
@ -303,11 +303,11 @@ mod test {
}
if expected == "" {
assert!(found_symbol.is_none(), "must have no symbols {:?}", found_symbol);
assert!(found_symbol.is_none(), "must have no symbols {found_symbol:?}");
return;
}
assert!(found_symbol.is_some(), "must have one symbol {:?}", found_symbol);
assert!(found_symbol.is_some(), "must have one symbol {found_symbol:?}");
let res = found_symbol.unwrap();
let formatted = format_symbol(res);
assert_eq!(formatted, expected);

View file

@ -70,7 +70,7 @@ impl flags::Search {
let sr = db.source_root(root);
for file_id in sr.iter() {
for debug_info in match_finder.debug_where_text_equal(file_id, debug_snippet) {
println!("{:#?}", debug_info);
println!("{debug_info:#?}");
}
}
}

View file

@ -9,7 +9,7 @@ impl flags::Symbols {
let (analysis, file_id) = Analysis::from_single_file(text);
let structure = analysis.file_structure(file_id).unwrap();
for s in structure {
println!("{:?}", s);
println!("{s:?}");
}
Ok(())
}

View file

@ -1869,14 +1869,14 @@ fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json:
fn key(f: &str) -> &str {
f.splitn(2, '_').next().unwrap()
}
assert!(key(f1) <= key(f2), "wrong field order: {:?} {:?}", f1, f2);
assert!(key(f1) <= key(f2), "wrong field order: {f1:?} {f2:?}");
}
let map = fields
.iter()
.map(|(field, ty, doc, default)| {
let name = field.replace('_', ".");
let name = format!("rust-analyzer.{}", name);
let name = format!("rust-analyzer.{name}");
let props = field_props(field, ty, doc, default);
(name, props)
})
@ -2166,7 +2166,7 @@ fn field_props(field: &str, ty: &str, doc: &[&str], default: &str) -> serde_json
},
],
},
_ => panic!("missing entry for {}: {}", ty, default),
_ => panic!("missing entry for {ty}: {default}"),
}
map.into()
@ -2194,14 +2194,14 @@ Default:
name, name, default, doc
)
} else {
format!("[[{}]]{} (default: `{}`)::\n+\n--\n{}--\n", name, name, default, doc)
format!("[[{name}]]{name} (default: `{default}`)::\n+\n--\n{doc}--\n")
}
})
.collect::<String>()
}
fn doc_comment_to_string(doc: &[&str]) -> String {
doc.iter().map(|it| it.strip_prefix(' ').unwrap_or(it)).map(|it| format!("{}\n", it)).collect()
doc.iter().map(|it| it.strip_prefix(' ').unwrap_or(it)).map(|it| format!("{it}\n")).collect()
}
#[cfg(test)]
@ -2215,7 +2215,7 @@ mod tests {
#[test]
fn generate_package_json_config() {
let s = Config::json_schema();
let schema = format!("{:#}", s);
let schema = format!("{s:#}");
let mut schema = schema
.trim_start_matches('{')
.trim_end_matches('}')

View file

@ -161,7 +161,7 @@ fn resolve_path(
.iter()
.find_map(|(from, to)| file_name.strip_prefix(from).map(|file_name| (to, file_name)))
{
Some((to, file_name)) => workspace_root.join(format!("{}{}", to, file_name)),
Some((to, file_name)) => workspace_root.join(format!("{to}{file_name}")),
None => workspace_root.join(file_name),
}
}
@ -218,7 +218,7 @@ fn map_rust_child_diagnostic(
if !suggested_replacements.is_empty() {
message.push_str(": ");
let suggestions =
suggested_replacements.iter().map(|suggestion| format!("`{}`", suggestion)).join(", ");
suggested_replacements.iter().map(|suggestion| format!("`{suggestion}`")).join(", ");
message.push_str(&suggestions);
}
@ -493,7 +493,7 @@ fn rustc_code_description(code: Option<&str>) -> Option<lsp_types::CodeDescripti
&& chars.next().is_none()
})
.and_then(|code| {
lsp_types::Url::parse(&format!("https://doc.rust-lang.org/error-index.html#{}", code))
lsp_types::Url::parse(&format!("https://doc.rust-lang.org/error-index.html#{code}"))
.ok()
.map(|href| lsp_types::CodeDescription { href })
})

View file

@ -145,7 +145,7 @@ impl<'a> RequestDispatcher<'a> {
match res {
Ok(params) => {
let panic_context =
format!("\nversion: {}\nrequest: {} {:#?}", version(), R::METHOD, params);
format!("\nversion: {}\nrequest: {} {params:#?}", version(), R::METHOD);
Some((req, params, panic_context))
}
Err(err) => {

View file

@ -429,6 +429,6 @@ pub(crate) fn file_id_to_url(vfs: &vfs::Vfs, id: FileId) -> Url {
pub(crate) fn url_to_file_id(vfs: &vfs::Vfs, url: &Url) -> Result<FileId> {
let path = from_proto::vfs_path(url)?;
let res = vfs.file_id(&path).ok_or_else(|| format!("file not found: {}", path))?;
let res = vfs.file_id(&path).ok_or_else(|| format!("file not found: {path}"))?;
Ok(res)
}

View file

@ -730,7 +730,7 @@ pub(crate) fn handle_runnables(
Some(spec) => {
for cmd in ["check", "test"] {
res.push(lsp_ext::Runnable {
label: format!("cargo {} -p {} --all-targets", cmd, spec.package),
label: format!("cargo {cmd} -p {} --all-targets", spec.package),
location: None,
kind: lsp_ext::RunnableKind::Cargo,
args: lsp_ext::CargoRunnable {
@ -1146,8 +1146,8 @@ pub(crate) fn handle_code_action_resolve(
Ok(parsed_data) => parsed_data,
Err(e) => {
return Err(invalid_params_error(format!(
"Failed to parse action id string '{}': {}",
params.id, e
"Failed to parse action id string '{}': {e}",
params.id
))
.into())
}
@ -1191,7 +1191,7 @@ fn parse_action_id(action_id: &str) -> Result<(usize, SingleResolve), String> {
let assist_kind: AssistKind = assist_kind_string.parse()?;
let index: usize = match index_string.parse() {
Ok(index) => index,
Err(e) => return Err(format!("Incorrect index string: {}", e)),
Err(e) => return Err(format!("Incorrect index string: {e}")),
};
Ok((index, SingleResolve { assist_id: assist_id_string.to_string(), assist_kind }))
}
@ -1870,7 +1870,7 @@ fn run_rustfmt(
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
.context(format!("Failed to spawn {:?}", command))?;
.context(format!("Failed to spawn {command:?}"))?;
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;
@ -1903,9 +1903,9 @@ fn run_rustfmt(
format!(
r#"rustfmt exited with:
Status: {}
stdout: {}
stderr: {}"#,
output.status, captured_stdout, captured_stderr,
stdout: {captured_stdout}
stderr: {captured_stderr}"#,
output.status,
),
)
.into())

View file

@ -48,7 +48,7 @@ fn integrated_highlighting_benchmark() {
let file_id = {
let file = workspace_to_load.join(file);
let path = VfsPath::from(AbsPathBuf::assert(file));
vfs.file_id(&path).unwrap_or_else(|| panic!("can't find virtual file for {}", path))
vfs.file_id(&path).unwrap_or_else(|| panic!("can't find virtual file for {path}"))
};
{
@ -102,7 +102,7 @@ fn integrated_completion_benchmark() {
let file_id = {
let file = workspace_to_load.join(file);
let path = VfsPath::from(AbsPathBuf::assert(file));
vfs.file_id(&path).unwrap_or_else(|| panic!("can't find virtual file for {}", path))
vfs.file_id(&path).unwrap_or_else(|| panic!("can't find virtual file for {path}"))
};
{

View file

@ -55,7 +55,7 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
pub fn from_json<T: DeserializeOwned>(what: &'static str, json: &serde_json::Value) -> Result<T> {
let res = serde_json::from_value(json.clone())
.map_err(|e| format!("Failed to deserialize {}: {}; {}", what, e, json))?;
.map_err(|e| format!("Failed to deserialize {what}: {e}; {json}"))?;
Ok(res)
}

View file

@ -98,7 +98,7 @@ impl GlobalState {
});
let cancellable = Some(cancel_token.is_some());
let token = lsp_types::ProgressToken::String(
cancel_token.unwrap_or_else(|| format!("rustAnalyzer/{}", title)),
cancel_token.unwrap_or_else(|| format!("rustAnalyzer/{title}")),
);
let work_done_progress = match state {
Progress::Begin => {

View file

@ -229,8 +229,8 @@ impl GlobalState {
message = match &report.crates_currently_indexing[..] {
[crate_name] => Some(format!(
"{}/{} ({})",
report.crates_done, report.crates_total, crate_name
"{}/{} ({crate_name})",
report.crates_done, report.crates_total
)),
[crate_name, rest @ ..] => Some(format!(
"{}/{} ({} + {} more)",
@ -516,7 +516,7 @@ impl GlobalState {
self.report_progress(
"Roots Scanned",
state,
Some(format!("{}/{}", n_done, n_total)),
Some(format!("{n_done}/{n_total}")),
Some(Progress::fraction(n_done, n_total)),
None,
)
@ -587,7 +587,7 @@ impl GlobalState {
state,
message,
None,
Some(format!("rust-analyzer/flycheck/{}", id)),
Some(format!("rust-analyzer/flycheck/{id}")),
);
}
}

View file

@ -342,7 +342,7 @@ fn completion_item(
// by the client. Hex format is used because it is easier to
// visually compare very large values, which the sort text
// tends to be since it is the opposite of the score.
res.sort_text = Some(format!("{:08x}", sort_score));
res.sort_text = Some(format!("{sort_score:08x}"));
}
}
@ -1113,7 +1113,7 @@ pub(crate) fn code_action(
(Some(it), _) => res.edit = Some(snippet_workspace_edit(snap, it)?),
(None, Some((index, code_action_params))) => {
res.data = Some(lsp_ext::CodeActionData {
id: format!("{}:{}:{}", assist.id.0, assist.id.1.name(), index),
id: format!("{}:{}:{index}", assist.id.0, assist.id.1.name()),
code_action_params,
});
}
@ -1352,7 +1352,7 @@ pub(crate) fn implementation_title(count: usize) -> String {
if count == 1 {
"1 implementation".into()
} else {
format!("{} implementations", count)
format!("{count} implementations")
}
}
@ -1360,7 +1360,7 @@ pub(crate) fn reference_title(count: usize) -> String {
if count == 1 {
"1 reference".into()
} else {
format!("{} references", count)
format!("{count} references")
}
}

View file

@ -263,7 +263,7 @@ mod tests {
for runnable in ["consumer", "dependency", "devdependency"] {
server.request::<Runnables>(
RunnablesParams {
text_document: server.doc_id(&format!("{}/src/lib.rs", runnable)),
text_document: server.doc_id(&format!("{runnable}/src/lib.rs")),
position: None,
},
json!([
@ -595,8 +595,8 @@ fn diagnostics_dont_block_typing() {
return;
}
let librs: String = (0..10).map(|i| format!("mod m{};", i)).collect();
let libs: String = (0..10).map(|i| format!("//- /src/m{}.rs\nfn foo() {{}}\n\n", i)).collect();
let librs: String = (0..10).map(|i| format!("mod m{i};")).collect();
let libs: String = (0..10).map(|i| format!("//- /src/m{i}.rs\nfn foo() {{}}\n\n")).collect();
let server = Project::with_fixture(&format!(
r#"
//- /Cargo.toml
@ -622,7 +622,7 @@ fn main() {{}}
for i in 0..10 {
server.notification::<DidOpenTextDocument>(DidOpenTextDocumentParams {
text_document: TextDocumentItem {
uri: server.doc_id(&format!("src/m{}.rs", i)).uri,
uri: server.doc_id(&format!("src/m{i}.rs")).uri,
language_id: "rust".to_string(),
version: 0,
text: "/// Docs\nfn foo() {}".to_string(),
@ -645,7 +645,7 @@ fn main() {{}}
}]),
);
let elapsed = start.elapsed();
assert!(elapsed.as_millis() < 2000, "typing enter took {:?}", elapsed);
assert!(elapsed.as_millis() < 2000, "typing enter took {elapsed:?}");
}
#[test]
@ -942,7 +942,7 @@ fn test_will_rename_files_same_level() {
let tmp_dir = TestDir::new();
let tmp_dir_path = tmp_dir.path().to_owned();
let tmp_dir_str = tmp_dir_path.to_str().unwrap();
let base_path = PathBuf::from(format!("file://{}", tmp_dir_str));
let base_path = PathBuf::from(format!("file://{tmp_dir_str}"));
let code = r#"
//- /Cargo.toml

View file

@ -42,7 +42,7 @@ impl Feature {
for block in comment_blocks {
let id = block.id;
if let Err(msg) = is_valid_feature_name(&id) {
panic!("invalid feature name: {:?}:\n {}", id, msg)
panic!("invalid feature name: {id:?}:\n {msg}")
}
let doc = block.contents.join("\n");
let location = sourcegen::Location { file: path.clone(), line: block.line };
@ -63,11 +63,11 @@ fn is_valid_feature_name(feature: &str) -> Result<(), String> {
}
for short in ["To", "And"] {
if word == short {
return Err(format!("Don't capitalize {:?}", word));
return Err(format!("Don't capitalize {word:?}"));
}
}
if !word.starts_with(char::is_uppercase) {
return Err(format!("Capitalize {:?}", word));
return Err(format!("Capitalize {word:?}"));
}
}
Ok(())

View file

@ -216,7 +216,7 @@ impl Server {
fn send_request_(&self, r: Request) -> Value {
let id = r.id.clone();
self.client.sender.send(r.clone().into()).unwrap();
while let Some(msg) = self.recv().unwrap_or_else(|Timeout| panic!("timeout: {:?}", r)) {
while let Some(msg) = self.recv().unwrap_or_else(|Timeout| panic!("timeout: {r:?}")) {
match msg {
Message::Request(req) => {
if req.method == "client/registerCapability" {
@ -228,19 +228,19 @@ impl Server {
continue;
}
}
panic!("unexpected request: {:?}", req)
panic!("unexpected request: {req:?}")
}
Message::Notification(_) => (),
Message::Response(res) => {
assert_eq!(res.id, id);
if let Some(err) = res.error {
panic!("error response: {:#?}", err);
panic!("error response: {err:#?}");
}
return res.result.unwrap();
}
}
}
panic!("no response for {:?}", r);
panic!("no response for {r:?}");
}
pub(crate) fn wait_until_workspace_is_loaded(self) -> Server {
self.wait_for_message_cond(1, &|msg: &Message| match msg {

View file

@ -28,7 +28,7 @@ impl TestDir {
static CNT: AtomicUsize = AtomicUsize::new(0);
for _ in 0..100 {
let cnt = CNT.fetch_add(1, Ordering::Relaxed);
let path = base.join(format!("{}_{}", pid, cnt));
let path = base.join(format!("{pid}_{cnt}"));
if path.is_dir() {
continue;
}
@ -53,7 +53,7 @@ impl Drop for TestDir {
return;
}
remove_dir_all(&self.path).unwrap_or_else(|err| {
panic!("failed to remove temporary directory {}: {}", self.path.display(), err)
panic!("failed to remove temporary directory {}: {err}", self.path.display())
})
}
}

View file

@ -216,18 +216,18 @@ Zlib OR Apache-2.0 OR MIT
diff.push_str("New Licenses:\n");
for &l in licenses.iter() {
if !expected.contains(&l) {
diff += &format!(" {}\n", l)
diff += &format!(" {l}\n")
}
}
diff.push_str("\nMissing Licenses:\n");
for &l in expected.iter() {
if !licenses.contains(&l) {
diff += &format!(" {}\n", l)
diff += &format!(" {l}\n")
}
}
panic!("different set of licenses!\n{}", diff);
panic!("different set of licenses!\n{diff}");
}
assert_eq!(licenses, expected);
}
@ -316,7 +316,7 @@ fn check_test_attrs(path: &Path, text: &str) {
"ide-assists/src/tests/generated.rs",
];
if text.contains("#[ignore") && !need_ignore.iter().any(|p| path.ends_with(p)) {
panic!("\ndon't `#[ignore]` tests, see:\n\n {}\n\n {}\n", ignore_rule, path.display(),)
panic!("\ndon't `#[ignore]` tests, see:\n\n {ignore_rule}\n\n {}\n", path.display(),)
}
let panic_rule =
@ -438,7 +438,7 @@ impl TidyMarks {
self.hits.symmetric_difference(&self.checks).map(|it| it.as_str()).collect();
if !diff.is_empty() {
panic!("unpaired marks: {:?}", diff)
panic!("unpaired marks: {diff:?}")
}
}
}