@@ -147,22 +147,27 @@ fn find_definitions(
147
147
} )
148
148
. map ( |def| ( name_like. clone ( ) , def) )
149
149
. ok_or_else ( || format_err ! ( "No references found at position" ) ) ,
150
- ast:: NameLike :: NameRef ( name_ref) => NameRefClass :: classify ( sema, name_ref)
151
- . map ( |class| match class {
152
- NameRefClass :: Definition ( def) => def,
153
- NameRefClass :: FieldShorthand { local_ref, field_ref : _ } => {
154
- Definition :: Local ( local_ref)
155
- }
156
- } )
157
- . and_then ( |def| {
158
- // if the name differs from the definitions name it has to be an alias
159
- if def. name ( sema. db ) . map_or ( false , |it| it. to_string ( ) != name_ref. text ( ) ) {
160
- None
161
- } else {
162
- Some ( ( name_like. clone ( ) , def) )
163
- }
164
- } )
165
- . ok_or_else ( || format_err ! ( "Renaming aliases is currently unsupported" ) ) ,
150
+ ast:: NameLike :: NameRef ( name_ref) => {
151
+ NameRefClass :: classify ( sema, name_ref)
152
+ . map ( |class| match class {
153
+ NameRefClass :: Definition ( def) => def,
154
+ NameRefClass :: FieldShorthand { local_ref, field_ref : _ } => {
155
+ Definition :: Local ( local_ref)
156
+ }
157
+ } )
158
+ . ok_or_else ( || format_err ! ( "No references found at position" ) )
159
+ . and_then ( |def| {
160
+ // if the name differs from the definitions name it has to be an alias
161
+ if def
162
+ . name ( sema. db )
163
+ . map_or ( false , |it| it. to_string ( ) != name_ref. text ( ) )
164
+ {
165
+ Err ( format_err ! ( "Renaming aliases is currently unsupported" ) )
166
+ } else {
167
+ Ok ( ( name_like. clone ( ) , def) )
168
+ }
169
+ } )
170
+ }
166
171
ast:: NameLike :: Lifetime ( lifetime) => {
167
172
NameRefClass :: classify_lifetime ( sema, lifetime)
168
173
. and_then ( |class| match class {
@@ -183,8 +188,8 @@ fn find_definitions(
183
188
} ) ;
184
189
185
190
// TODO avoid collect() somehow?
186
- let v : RenameResult < Vec < ( ast:: NameLike , Definition ) > > = symbols. collect ( ) ;
187
- match v {
191
+ let res : RenameResult < Vec < ( ast:: NameLike , Definition ) > > = symbols. collect ( ) ;
192
+ match res {
188
193
// remove duplicates
189
194
Ok ( v) => {
190
195
if v. is_empty ( ) {
0 commit comments