We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
replace_derive_with_manual_impl
1 parent 1834938 commit 6624158Copy full SHA for 6624158
crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs
@@ -47,6 +47,11 @@ pub(crate) fn replace_derive_with_manual_impl(
47
return None;
48
}
49
50
+ if !args.syntax().text_range().contains(ctx.offset()) {
51
+ cov_mark::hit!(outside_of_attr_args);
52
+ return None;
53
+ }
54
+
55
let trait_token = args.syntax().token_at_offset(ctx.offset()).find(|t| t.kind() == IDENT)?;
56
let trait_name = trait_token.text();
57
@@ -396,4 +401,16 @@ struct Foo {}
396
401
",
397
402
)
398
403
404
405
+ #[test]
406
+ fn works_at_start_of_file() {
407
+ cov_mark::check!(outside_of_attr_args);
408
+ check_assist_not_applicable(
409
+ replace_derive_with_manual_impl,
410
+ r#"
411
+$0#[derive(Debug)]
412
+struct S;
413
+ "#,
414
+ );
415
399
416
0 commit comments