summaryrefslogtreecommitdiffstats
path: root/src/tools/rust-analyzer/crates/ide-db
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/rust-analyzer/crates/ide-db')
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/assists.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/lib.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/rename.rs12
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/search.rs4
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs2
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs20
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs29
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt134
-rw-r--r--src/tools/rust-analyzer/crates/ide-db/src/tests/sourcegen_lints.rs6
13 files changed, 65 insertions, 154 deletions
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/assists.rs b/src/tools/rust-analyzer/crates/ide-db/src/assists.rs
index da23763dc..8c6c1c44a 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/assists.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/assists.rs
@@ -88,7 +88,7 @@ impl FromStr for AssistKind {
"RefactorExtract" => Ok(AssistKind::RefactorExtract),
"RefactorInline" => Ok(AssistKind::RefactorInline),
"RefactorRewrite" => Ok(AssistKind::RefactorRewrite),
- unknown => Err(format!("Unknown AssistKind: '{}'", unknown)),
+ unknown => Err(format!("Unknown AssistKind: '{unknown}'")),
}
}
}
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
index 64dd2bb5f..f0c369096 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/generated/lints.rs
@@ -3624,7 +3624,7 @@ of a library.
Plugins can extend [Rust's lint
infrastructure](../../reference/attributes/diagnostics.md#lint-check-attributes) with
additional checks for code style, safety, etc. Now let's write a plugin
-[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/src/test/ui-fulldeps/auxiliary/lint-plugin-test.rs)
+[`lint-plugin-test.rs`](https://github.com/rust-lang/rust/blob/master/tests/ui-fulldeps/auxiliary/lint-plugin-test.rs)
that warns about any item named `lintme`.
```rust,ignore (requires-stage-2)
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs
index 40a6a3e89..994d48385 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/import_assets.rs
@@ -367,7 +367,7 @@ fn import_for_item(
let expected_import_end = if item_as_assoc(db, original_item).is_some() {
unresolved_qualifier.to_string()
} else {
- format!("{}::{}", unresolved_qualifier, item_name(db, original_item)?)
+ format!("{unresolved_qualifier}::{}", item_name(db, original_item)?)
};
if !import_path_string.contains(unresolved_first_segment)
|| !import_path_string.ends_with(&expected_import_end)
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs
index 59673af32..b92e367f7 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/insert_use/tests.rs
@@ -1014,7 +1014,7 @@ fn check_with_config(
.and_then(|it| ImportScope::find_insert_use_container(&it, sema))
.or_else(|| ImportScope::from(syntax))
.unwrap();
- let path = ast::SourceFile::parse(&format!("use {};", path))
+ let path = ast::SourceFile::parse(&format!("use {path};"))
.tree()
.syntax()
.descendants()
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs b/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs
index 371d642c1..27b6321f3 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/imports/merge_imports.rs
@@ -91,7 +91,7 @@ fn recursive_merge(lhs: &ast::UseTree, rhs: &ast::UseTree, merge: MergeBehavior)
.flat_map(|list| list.use_trees())
// We use Option here to early return from this function(this is not the
// same as a `filter` op).
- .map(|tree| merge.is_tree_allowed(&tree).then(|| tree))
+ .map(|tree| merge.is_tree_allowed(&tree).then_some(tree))
.collect::<Option<_>>()?;
use_trees.sort_unstable_by(|a, b| path_cmp_for_sort(a.path(), b.path()));
for rhs_t in rhs.use_tree_list().into_iter().flat_map(|list| list.use_trees()) {
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/lib.rs b/src/tools/rust-analyzer/crates/ide-db/src/lib.rs
index e0bc0f89f..156bbb634 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/lib.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/lib.rs
@@ -165,7 +165,7 @@ pub trait LineIndexDatabase: base_db::SourceDatabase {
fn line_index(db: &dyn LineIndexDatabase, file_id: FileId) -> Arc<LineIndex> {
let text = db.file_text(file_id);
- Arc::new(LineIndex::new(&*text))
+ Arc::new(LineIndex::new(&text))
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/rename.rs b/src/tools/rust-analyzer/crates/ide-db/src/rename.rs
index 49b81265e..cd4a7e155 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/rename.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/rename.rs
@@ -197,7 +197,7 @@ fn rename_mod(
// Module exists in a named file
if !is_mod_rs {
- let path = format!("{}.rs", new_name);
+ let path = format!("{new_name}.rs");
let dst = AnchoredPathBuf { anchor, path };
source_change.push_file_system_edit(FileSystemEdit::MoveFile { src: anchor, dst })
}
@@ -207,9 +207,7 @@ fn rename_mod(
// - Module has submodules defined in separate files
let dir_paths = match (is_mod_rs, has_detached_child, module.name(sema.db)) {
// Go up one level since the anchor is inside the dir we're trying to rename
- (true, _, Some(mod_name)) => {
- Some((format!("../{}", mod_name), format!("../{}", new_name)))
- }
+ (true, _, Some(mod_name)) => Some((format!("../{mod_name}"), format!("../{new_name}"))),
// The anchor is on the same level as target dir
(false, true, Some(mod_name)) => Some((mod_name.to_string(), new_name.to_string())),
_ => None,
@@ -356,7 +354,7 @@ fn source_edit_from_name(edit: &mut TextEditBuilder, name: &ast::Name, new_name:
// FIXME: instead of splitting the shorthand, recursively trigger a rename of the
// other name https://github.com/rust-lang/rust-analyzer/issues/6547
- edit.insert(ident_pat.syntax().text_range().start(), format!("{}: ", new_name));
+ edit.insert(ident_pat.syntax().text_range().start(), format!("{new_name}: "));
return true;
}
}
@@ -414,7 +412,7 @@ fn source_edit_from_name_ref(
// Foo { field } -> Foo { new_name: field }
// ^ insert `new_name: `
let offset = name_ref.syntax().text_range().start();
- edit.insert(offset, format!("{}: ", new_name));
+ edit.insert(offset, format!("{new_name}: "));
return true;
}
(None, Some(_)) if matches!(def, Definition::Local(_)) => {
@@ -422,7 +420,7 @@ fn source_edit_from_name_ref(
// Foo { field } -> Foo { field: new_name }
// ^ insert `: new_name`
let offset = name_ref.syntax().text_range().end();
- edit.insert(offset, format!(": {}", new_name));
+ edit.insert(offset, format!(": {new_name}"));
return true;
}
_ => (),
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/search.rs b/src/tools/rust-analyzer/crates/ide-db/src/search.rs
index aa5d7e9be..b2b0e4908 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/search.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/search.rs
@@ -608,7 +608,7 @@ impl<'a> FindUsages<'a> {
let reference = FileReference {
range,
name: ast::NameLike::NameRef(name_ref.clone()),
- category: is_name_ref_in_import(name_ref).then(|| ReferenceCategory::Import),
+ category: is_name_ref_in_import(name_ref).then_some(ReferenceCategory::Import),
};
sink(file_id, reference)
}
@@ -787,7 +787,7 @@ impl ReferenceCategory {
fn new(def: &Definition, r: &ast::NameRef) -> Option<ReferenceCategory> {
// Only Locals and Fields have accesses for now.
if !matches!(def, Definition::Local(_) | Definition::Field(_)) {
- return is_name_ref_in_import(r).then(|| ReferenceCategory::Import);
+ return is_name_ref_in_import(r).then_some(ReferenceCategory::Import);
}
let mode = r.syntax().ancestors().find_map(|node| {
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs b/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs
index bfb003127..c054cc159 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/symbol_index.rs
@@ -206,7 +206,7 @@ pub fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol> {
}
pub fn crate_symbols(db: &RootDatabase, krate: Crate, query: Query) -> Vec<FileSymbol> {
- let _p = profile::span("crate_symbols").detail(|| format!("{:?}", query));
+ let _p = profile::span("crate_symbols").detail(|| format!("{query:?}"));
let modules = krate.modules(db);
let indices: Vec<_> = modules
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs
index 313346ee1..fcef71fb7 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/format_string_exprs.rs
@@ -140,8 +140,8 @@ pub fn parse_format_exprs(input: &str) -> Result<(String, Vec<Arg>), ()> {
output.push_str(trimmed);
} else if matches!(state, State::Expr) {
extracted_expressions.push(Arg::Expr(trimmed.into()));
- } else {
- extracted_expressions.push(Arg::Ident(trimmed.into()));
+ } else if matches!(state, State::Ident) {
+ output.push_str(trimmed);
}
output.push(chr);
@@ -205,7 +205,7 @@ mod tests {
fn check(input: &str, expect: &Expect) {
let (output, exprs) = parse_format_exprs(input).unwrap_or(("-".to_string(), vec![]));
let outcome_repr = if !exprs.is_empty() {
- format!("{}; {}", output, with_placeholders(exprs).join(", "))
+ format!("{output}; {}", with_placeholders(exprs).join(", "))
} else {
output
};
@@ -218,9 +218,9 @@ mod tests {
let test_vector = &[
("no expressions", expect![["no expressions"]]),
(r"no expressions with \$0$1", expect![r"no expressions with \\\$0\$1"]),
- ("{expr} is {2 + 2}", expect![["{} is {}; expr, 2 + 2"]]),
- ("{expr:?}", expect![["{:?}; expr"]]),
- ("{expr:1$}", expect![[r"{:1\$}; expr"]]),
+ ("{expr} is {2 + 2}", expect![["{expr} is {}; 2 + 2"]]),
+ ("{expr:?}", expect![["{expr:?}"]]),
+ ("{expr:1$}", expect![[r"{expr:1\$}"]]),
("{:1$}", expect![[r"{:1\$}; $1"]]),
("{:>padding$}", expect![[r"{:>padding\$}; $1"]]),
("{}, {}, {0}", expect![[r"{}, {}, {0}; $1, $2"]]),
@@ -230,8 +230,8 @@ mod tests {
("malformed}", expect![["-"]]),
("{{correct", expect![["{{correct"]]),
("correct}}", expect![["correct}}"]]),
- ("{correct}}}", expect![["{}}}; correct"]]),
- ("{correct}}}}}", expect![["{}}}}}; correct"]]),
+ ("{correct}}}", expect![["{correct}}}"]]),
+ ("{correct}}}}}", expect![["{correct}}}}}"]]),
("{incorrect}}", expect![["-"]]),
("placeholders {} {}", expect![["placeholders {} {}; $1, $2"]]),
("mixed {} {2 + 2} {}", expect![["mixed {} {} {}; $1, 2 + 2, $2"]]),
@@ -239,7 +239,7 @@ mod tests {
"{SomeStruct { val_a: 0, val_b: 1 }}",
expect![["{}; SomeStruct { val_a: 0, val_b: 1 }"]],
),
- ("{expr:?} is {2.32f64:.5}", expect![["{:?} is {:.5}; expr, 2.32f64"]]),
+ ("{expr:?} is {2.32f64:.5}", expect![["{expr:?} is {:.5}; 2.32f64"]]),
(
"{SomeStruct { val_a: 0, val_b: 1 }:?}",
expect![["{:?}; SomeStruct { val_a: 0, val_b: 1 }"]],
@@ -262,8 +262,6 @@ mod tests {
.unwrap()
.1,
vec![
- Arg::Ident("_ident".to_owned()),
- Arg::Ident("r#raw_ident".to_owned()),
Arg::Expr("expr.obj".to_owned()),
Arg::Expr("name {thing: 42}".to_owned()),
Arg::Placeholder
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs
index 39710b8f1..a34dc1b69 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/syntax_helpers/node_ext.rs
@@ -173,7 +173,8 @@ pub fn walk_pat(pat: &ast::Pat, cb: &mut dyn FnMut(ast::Pat)) {
}
/// Preorder walk all the type's sub types.
-pub fn walk_ty(ty: &ast::Type, cb: &mut dyn FnMut(ast::Type)) {
+// FIXME: Make the control flow more proper
+pub fn walk_ty(ty: &ast::Type, cb: &mut dyn FnMut(ast::Type) -> bool) {
let mut preorder = ty.syntax().preorder();
while let Some(event) = preorder.next() {
let node = match event {
@@ -184,10 +185,12 @@ pub fn walk_ty(ty: &ast::Type, cb: &mut dyn FnMut(ast::Type)) {
match ast::Type::cast(node) {
Some(ty @ ast::Type::MacroType(_)) => {
preorder.skip_subtree();
- cb(ty)
+ cb(ty);
}
Some(ty) => {
- cb(ty);
+ if cb(ty) {
+ preorder.skip_subtree();
+ }
}
// skip const args
None if ast::ConstArg::can_cast(kind) => {
@@ -252,6 +255,11 @@ pub fn is_pattern_cond(expr: ast::Expr) -> bool {
/// Note that modifying the tree while iterating it will cause undefined iteration which might
/// potentially results in an out of bounds panic.
pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
+ let walk_loop = |cb: &mut dyn FnMut(&ast::Expr), label, body: Option<ast::BlockExpr>| {
+ for_each_break_expr(label, body.and_then(|it| it.stmt_list()), &mut |b| {
+ cb(&ast::Expr::BreakExpr(b))
+ })
+ };
match expr {
ast::Expr::BlockExpr(b) => {
match b.modifier() {
@@ -291,11 +299,9 @@ pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
}
}
}
- ast::Expr::LoopExpr(l) => {
- for_each_break_expr(l.label(), l.loop_body().and_then(|it| it.stmt_list()), &mut |b| {
- cb(&ast::Expr::BreakExpr(b))
- })
- }
+ ast::Expr::LoopExpr(l) => walk_loop(cb, l.label(), l.loop_body()),
+ ast::Expr::WhileExpr(w) => walk_loop(cb, w.label(), w.loop_body()),
+ ast::Expr::ForExpr(f) => walk_loop(cb, f.label(), f.loop_body()),
ast::Expr::MatchExpr(m) => {
if let Some(arms) = m.match_arm_list() {
arms.arms().filter_map(|arm| arm.expr()).for_each(|e| for_each_tail_expr(&e, cb));
@@ -311,7 +317,6 @@ pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
| ast::Expr::ClosureExpr(_)
| ast::Expr::ContinueExpr(_)
| ast::Expr::FieldExpr(_)
- | ast::Expr::ForExpr(_)
| ast::Expr::IndexExpr(_)
| ast::Expr::Literal(_)
| ast::Expr::MacroExpr(_)
@@ -325,10 +330,10 @@ pub fn for_each_tail_expr(expr: &ast::Expr, cb: &mut dyn FnMut(&ast::Expr)) {
| ast::Expr::ReturnExpr(_)
| ast::Expr::TryExpr(_)
| ast::Expr::TupleExpr(_)
- | ast::Expr::WhileExpr(_)
| ast::Expr::LetExpr(_)
| ast::Expr::UnderscoreExpr(_)
- | ast::Expr::YieldExpr(_) => cb(expr),
+ | ast::Expr::YieldExpr(_)
+ | ast::Expr::YeetExpr(_) => cb(expr),
}
}
@@ -447,7 +452,7 @@ pub fn parse_tt_as_comma_sep_paths(input: ast::TokenTree) -> Option<Vec<ast::Pat
let input_expressions = tokens.group_by(|tok| tok.kind() == T![,]);
let paths = input_expressions
.into_iter()
- .filter_map(|(is_sep, group)| (!is_sep).then(|| group))
+ .filter_map(|(is_sep, group)| (!is_sep).then_some(group))
.filter_map(|mut tokens| {
syntax::hacks::parse_expr_from_str(&tokens.join("")).and_then(|expr| match expr {
ast::Expr::PathExpr(it) => it.path(),
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt b/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt
index 2f531ca0c..8c11408de 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt
+++ b/src/tools/rust-analyzer/crates/ide-db/src/test_data/test_symbol_index_collection.txt
@@ -14,11 +14,7 @@
name: "Alias",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: TYPE_ALIAS,
@@ -36,11 +32,7 @@
name: "CONST",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: CONST,
@@ -58,11 +50,7 @@
name: "CONST_WITH_INNER",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: CONST,
@@ -80,11 +68,7 @@
name: "Enum",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: ENUM,
@@ -102,11 +86,7 @@
name: "Macro",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: MACRO_DEF,
@@ -124,11 +104,7 @@
name: "STATIC",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: STATIC,
@@ -146,11 +122,7 @@
name: "Struct",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
@@ -168,13 +140,7 @@
name: "StructFromMacro",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- MacroFile(
- MacroFile {
- macro_call_id: MacroCallId(
- 0,
- ),
- },
- ),
+ 2147483648,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
@@ -192,11 +158,7 @@
name: "StructInFn",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
@@ -216,11 +178,7 @@
name: "StructInNamedConst",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
@@ -240,11 +198,7 @@
name: "StructInUnnamedConst",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
@@ -262,11 +216,7 @@
name: "Trait",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: TRAIT,
@@ -284,11 +234,7 @@
name: "Union",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: UNION,
@@ -306,11 +252,7 @@
name: "a_mod",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: MODULE,
@@ -328,11 +270,7 @@
name: "b_mod",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: MODULE,
@@ -350,11 +288,7 @@
name: "define_struct",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: MACRO_RULES,
@@ -372,11 +306,7 @@
name: "impl_fn",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: FN,
@@ -394,11 +324,7 @@
name: "macro_rules_macro",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: MACRO_RULES,
@@ -416,11 +342,7 @@
name: "main",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: FN,
@@ -438,11 +360,7 @@
name: "trait_fn",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: FN,
@@ -475,11 +393,7 @@
name: "StructInModA",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 0,
- ),
- ),
+ 0,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
@@ -510,11 +424,7 @@
name: "StructInModB",
loc: DeclarationLocation {
hir_file_id: HirFileId(
- FileId(
- FileId(
- 1,
- ),
- ),
+ 1,
),
ptr: SyntaxNodePtr {
kind: STRUCT,
diff --git a/src/tools/rust-analyzer/crates/ide-db/src/tests/sourcegen_lints.rs b/src/tools/rust-analyzer/crates/ide-db/src/tests/sourcegen_lints.rs
index 5042f6d81..c7d5f3613 100644
--- a/src/tools/rust-analyzer/crates/ide-db/src/tests/sourcegen_lints.rs
+++ b/src/tools/rust-analyzer/crates/ide-db/src/tests/sourcegen_lints.rs
@@ -241,9 +241,9 @@ fn generate_descriptor_clippy(buf: &mut String, path: &Path) {
buf.push_str(r#"pub const CLIPPY_LINT_GROUPS: &[LintGroup] = &["#);
for (id, children) in clippy_groups {
- let children = children.iter().map(|id| format!("clippy::{}", id)).collect::<Vec<_>>();
+ let children = children.iter().map(|id| format!("clippy::{id}")).collect::<Vec<_>>();
if !children.is_empty() {
- let lint_ident = format!("clippy::{}", id);
+ let lint_ident = format!("clippy::{id}");
let description = format!("lint group for: {}", children.iter().join(", "));
push_lint_group(buf, &lint_ident, &description, &children);
}
@@ -273,7 +273,7 @@ fn push_lint_group(buf: &mut String, label: &str, description: &str, children: &
push_lint_completion(buf, label, description);
- let children = format!("&[{}]", children.iter().map(|it| format!("\"{}\"", it)).join(", "));
+ let children = format!("&[{}]", children.iter().map(|it| format!("\"{it}\"")).join(", "));
format_to!(
buf,
r###"