File tree Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Expand file tree Collapse file tree 1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -378,7 +378,11 @@ fn is_enum_name_similar_to_param_name(
378378fn get_string_representation ( expr : & ast:: Expr ) -> Option < String > {
379379 match expr {
380380 ast:: Expr :: MethodCallExpr ( method_call_expr) => {
381- Some ( method_call_expr. name_ref ( ) ?. to_string ( ) )
381+ let name_ref = method_call_expr. name_ref ( ) ?;
382+ match name_ref. text ( ) . as_str ( ) {
383+ "clone" => method_call_expr. receiver ( ) . map ( |rec| rec. to_string ( ) ) ,
384+ name_ref => Some ( name_ref. to_owned ( ) ) ,
385+ }
382386 }
383387 ast:: Expr :: RefExpr ( ref_expr) => get_string_representation ( & ref_expr. expr ( ) ?) ,
384388 _ => Some ( expr. to_string ( ) ) ,
@@ -1205,6 +1209,29 @@ fn main() {
12051209 let iter_of_iters = some_iter.take(2);
12061210 //^^^^^^^^^^^^^ impl Iterator<Item = impl Iterator<Item = i32>>
12071211}
1212+ "# ,
1213+ ) ;
1214+ }
1215+
1216+ #[ test]
1217+ fn hide_param_hints_for_clones ( ) {
1218+ check_with_config (
1219+ InlayHintsConfig {
1220+ parameter_hints : true ,
1221+ type_hints : false ,
1222+ chaining_hints : false ,
1223+ max_length : None ,
1224+ } ,
1225+ r#"
1226+ fn foo(bar: i32, baz: String, qux: f32) {}
1227+
1228+ fn main() {
1229+ let bar = 3;
1230+ let baz = &"baz";
1231+ let fez = 1.0;
1232+ foo(bar.clone(), baz.clone(), fez.clone());
1233+ //^^^^^^^^^^^ qux
1234+ }
12081235"# ,
12091236 ) ;
12101237 }
You can’t perform that action at this time.
0 commit comments