File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed
src/tools/rust-analyzer/crates/ide-db/src Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -538,14 +538,6 @@ impl Ctx<'_> {
538538 editor : & mut SyntaxEditor ,
539539 ident_pat : & ast:: IdentPat ,
540540 ) -> Option < ( ) > {
541- // Check if IdentPat is inside a function parameter.
542- // Parameter names are bindings, not references, thus should not be qualified.
543- for ancestor in ident_pat. syntax ( ) . ancestors ( ) {
544- if ast:: Param :: can_cast ( ancestor. kind ( ) ) {
545- return None ;
546- }
547- }
548-
549541 let name = ident_pat. name ( ) ?;
550542
551543 let temp_path = make:: path_from_text ( & name. text ( ) ) ;
@@ -554,7 +546,9 @@ impl Ctx<'_> {
554546
555547 match resolution {
556548 hir:: PathResolution :: Def ( def) if def. as_assoc_item ( self . source_scope . db ) . is_none ( ) => {
557- // Don't qualify macros - they can't be used in pattern position
549+ // Macros cannot be used in pattern position, and identifiers that happen
550+ // to have the same name as macros (like parameter names `vec`, `format`, etc.)
551+ // are bindings, not references. Don't qualify them.
558552 if matches ! ( def, hir:: ModuleDef :: Macro ( _) ) {
559553 return None ;
560554 }
You can’t perform that action at this time.
0 commit comments