File tree Expand file tree Collapse file tree 4 files changed +27
-31
lines changed
crates/pyrefly_config/src
pyrefly/lib/state/lsp/quick_fixes Expand file tree Collapse file tree 4 files changed +27
-31
lines changed Original file line number Diff line number Diff line change @@ -835,8 +835,8 @@ impl ConfigFile {
835835 self . handle_from_module_path_with_fallback ( module_path, & FallbackSearchPath :: Empty )
836836 }
837837
838- pub fn handle_from_module_path_with_fallback < ' a > (
839- & ' a self ,
838+ pub fn handle_from_module_path_with_fallback (
839+ & self ,
840840 module_path : ModulePath ,
841841 fallback_search_path : & FallbackSearchPath ,
842842 ) -> Handle {
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ pub(crate) fn inline_method_code_actions(
8080 & function_def,
8181 & call,
8282 receiver_name. as_str ( ) ,
83- receiver_text. as_deref ( ) ,
83+ receiver_text,
8484 module_info. contents ( ) ,
8585 ) ?;
8686 let return_expr = match function_def. body . as_slice ( ) {
@@ -203,7 +203,7 @@ fn build_param_map(
203203 let arg_value = call
204204 . arguments
205205 . find_argument_value ( param_name, positional_index)
206- . or_else ( || param. default . as_deref ( ) ) ;
206+ . or ( param. default . as_deref ( ) ) ;
207207 let arg_expr = arg_value?;
208208 let start = arg_expr. range ( ) . start ( ) . to_usize ( ) ;
209209 let end = arg_expr. range ( ) . end ( ) . to_usize ( ) . min ( source. len ( ) ) ;
@@ -267,10 +267,10 @@ fn collect_param_replacements(
267267 * invalid = true ;
268268 return ;
269269 }
270- if matches ! ( name. ctx, ExprContext :: Load ) {
271- if let Some ( replacement) = param_map. get ( name. id . as_str ( ) ) {
272- replacements . push ( ( name . range ( ) , replacement . clone ( ) ) ) ;
273- }
270+ if matches ! ( name. ctx, ExprContext :: Load )
271+ && let Some ( replacement) = param_map. get ( name. id . as_str ( ) )
272+ {
273+ replacements . push ( ( name . range ( ) , replacement . clone ( ) ) ) ;
274274 }
275275 }
276276 _ => { }
Original file line number Diff line number Diff line change @@ -131,21 +131,17 @@ fn collect_calls_to_definition(
131131 let mut calls = Vec :: new ( ) ;
132132 let mut name_calls = Vec :: new ( ) ;
133133 ast. visit ( & mut |expr| {
134- if let Expr :: Call ( call) = expr {
135- if let Expr :: Name ( name) = call. func . as_ref ( ) {
136- let defs = transaction. find_definition (
137- handle,
138- name. range . start ( ) ,
139- FindPreference :: default ( ) ,
140- ) ;
141- if defs. iter ( ) . any ( |def| {
142- def. module . path ( ) == module_info. path ( )
143- && def. definition_range == definition_range
144- } ) {
145- calls. push ( call. clone ( ) ) ;
146- } else if name. id . as_str ( ) == function_name {
147- name_calls. push ( call. clone ( ) ) ;
148- }
134+ if let Expr :: Call ( call) = expr
135+ && let Expr :: Name ( name) = call. func . as_ref ( )
136+ {
137+ let defs =
138+ transaction. find_definition ( handle, name. range . start ( ) , FindPreference :: default ( ) ) ;
139+ if defs. iter ( ) . any ( |def| {
140+ def. module . path ( ) == module_info. path ( ) && def. definition_range == definition_range
141+ } ) {
142+ calls. push ( call. clone ( ) ) ;
143+ } else if name. id . as_str ( ) == function_name {
144+ name_calls. push ( call. clone ( ) ) ;
149145 }
150146 }
151147 } ) ;
Original file line number Diff line number Diff line change @@ -180,15 +180,15 @@ fn enclosing_scope_range(
180180) -> Option < TextRange > {
181181 let covering_nodes = Ast :: locate_node ( ast, definition_range. start ( ) ) ;
182182 for node in covering_nodes {
183- if let Some ( function_def) = node. as_stmt_function_def ( ) {
184- if function_def. range ( ) . contains_range ( definition_range) {
185- return Some ( function_def . range ( ) ) ;
186- }
183+ if let Some ( function_def) = node. as_stmt_function_def ( )
184+ && function_def. range ( ) . contains_range ( definition_range)
185+ {
186+ return Some ( function_def . range ( ) ) ;
187187 }
188- if let Some ( class_def) = node. as_stmt_class_def ( ) {
189- if class_def. range ( ) . contains_range ( definition_range) {
190- return Some ( class_def . range ( ) ) ;
191- }
188+ if let Some ( class_def) = node. as_stmt_class_def ( )
189+ && class_def. range ( ) . contains_range ( definition_range)
190+ {
191+ return Some ( class_def . range ( ) ) ;
192192 }
193193 }
194194 let module_len = TextSize :: try_from ( module_len) . ok ( ) ?;
You can’t perform that action at this time.
0 commit comments