aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src/diagnostics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src/diagnostics.rs')
-rw-r--r--crates/ide/src/diagnostics.rs44
1 files changed, 22 insertions, 22 deletions
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs
index 79d126ff2..6931a6190 100644
--- a/crates/ide/src/diagnostics.rs
+++ b/crates/ide/src/diagnostics.rs
@@ -315,7 +315,7 @@ fn div(x: i32, y: i32) -> Result<i32, ()> {
315 if y == 0 { 315 if y == 0 {
316 return Err(()); 316 return Err(());
317 } 317 }
318 x / y<|> 318 x / y$0
319} 319}
320//- /core/lib.rs crate:core 320//- /core/lib.rs crate:core
321pub mod result { 321pub mod result {
@@ -346,7 +346,7 @@ fn div<T>(x: T) -> Result<T, i32> {
346 if x == 0 { 346 if x == 0 {
347 return Err(7); 347 return Err(7);
348 } 348 }
349 <|>x 349 $0x
350} 350}
351//- /core/lib.rs crate:core 351//- /core/lib.rs crate:core
352pub mod result { 352pub mod result {
@@ -379,7 +379,7 @@ fn div(x: i32, y: i32) -> MyResult<i32> {
379 if y == 0 { 379 if y == 0 {
380 return Err(()); 380 return Err(());
381 } 381 }
382 x <|>/ y 382 x $0/ y
383} 383}
384//- /core/lib.rs crate:core 384//- /core/lib.rs crate:core
385pub mod result { 385pub mod result {
@@ -444,7 +444,7 @@ pub mod result {
444struct TestStruct { one: i32, two: i64 } 444struct TestStruct { one: i32, two: i64 }
445 445
446fn test_fn() { 446fn test_fn() {
447 let s = TestStruct {<|>}; 447 let s = TestStruct {$0};
448} 448}
449"#, 449"#,
450 r#" 450 r#"
@@ -464,7 +464,7 @@ fn test_fn() {
464struct TestStruct { one: i32 } 464struct TestStruct { one: i32 }
465 465
466impl TestStruct { 466impl TestStruct {
467 fn test_fn() { let s = Self {<|>}; } 467 fn test_fn() { let s = Self {$0}; }
468} 468}
469"#, 469"#,
470 r#" 470 r#"
@@ -487,7 +487,7 @@ enum Expr {
487 487
488impl Expr { 488impl Expr {
489 fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr { 489 fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr {
490 Expr::Bin {<|> } 490 Expr::Bin {$0 }
491 } 491 }
492} 492}
493"#, 493"#,
@@ -512,7 +512,7 @@ impl Expr {
512struct TestStruct { one: i32, two: i64 } 512struct TestStruct { one: i32, two: i64 }
513 513
514fn test_fn() { 514fn test_fn() {
515 let s = TestStruct{ two: 2<|> }; 515 let s = TestStruct{ two: 2$0 };
516} 516}
517"#, 517"#,
518 r" 518 r"
@@ -608,7 +608,7 @@ fn here() {}
608macro_rules! id { ($($tt:tt)*) => { $($tt)*}; } 608macro_rules! id { ($($tt:tt)*) => { $($tt)*}; }
609 609
610fn main() { 610fn main() {
611 let _x = id![Foo { a: <|>42 }]; 611 let _x = id![Foo { a: $042 }];
612} 612}
613 613
614pub struct Foo { pub a: i32, pub b: i32 } 614pub struct Foo { pub a: i32, pub b: i32 }
@@ -663,7 +663,7 @@ mod a {
663 check_fix( 663 check_fix(
664 r" 664 r"
665 mod b {} 665 mod b {}
666 use {<|>b}; 666 use {$0b};
667 ", 667 ",
668 r" 668 r"
669 mod b {} 669 mod b {}
@@ -673,7 +673,7 @@ mod a {
673 check_fix( 673 check_fix(
674 r" 674 r"
675 mod b {} 675 mod b {}
676 use {b<|>}; 676 use {b$0};
677 ", 677 ",
678 r" 678 r"
679 mod b {} 679 mod b {}
@@ -683,7 +683,7 @@ mod a {
683 check_fix( 683 check_fix(
684 r" 684 r"
685 mod a { mod c {} } 685 mod a { mod c {} }
686 use a::{c<|>}; 686 use a::{c$0};
687 ", 687 ",
688 r" 688 r"
689 mod a { mod c {} } 689 mod a { mod c {} }
@@ -693,7 +693,7 @@ mod a {
693 check_fix( 693 check_fix(
694 r" 694 r"
695 mod a {} 695 mod a {}
696 use a::{self<|>}; 696 use a::{self$0};
697 ", 697 ",
698 r" 698 r"
699 mod a {} 699 mod a {}
@@ -703,7 +703,7 @@ mod a {
703 check_fix( 703 check_fix(
704 r" 704 r"
705 mod a { mod c {} mod d { mod e {} } } 705 mod a { mod c {} mod d { mod e {} } }
706 use a::{c, d::{e<|>}}; 706 use a::{c, d::{e$0}};
707 ", 707 ",
708 r" 708 r"
709 mod a { mod c {} mod d { mod e {} } } 709 mod a { mod c {} mod d { mod e {} } }
@@ -717,7 +717,7 @@ mod a {
717 check_fix( 717 check_fix(
718 r" 718 r"
719fn main() { 719fn main() {
720 Foo { bar: 3, baz<|>: false}; 720 Foo { bar: 3, baz$0: false};
721} 721}
722struct Foo { 722struct Foo {
723 bar: i32 723 bar: i32
@@ -743,7 +743,7 @@ struct Foo {
743mod foo; 743mod foo;
744 744
745fn main() { 745fn main() {
746 foo::Foo { bar: 3, <|>baz: false}; 746 foo::Foo { bar: 3, $0baz: false};
747} 747}
748//- /foo.rs 748//- /foo.rs
749struct Foo { 749struct Foo {
@@ -777,7 +777,7 @@ struct Foo {
777 fn test_rename_incorrect_case() { 777 fn test_rename_incorrect_case() {
778 check_fix( 778 check_fix(
779 r#" 779 r#"
780pub struct test_struct<|> { one: i32 } 780pub struct test_struct$0 { one: i32 }
781 781
782pub fn some_fn(val: test_struct) -> test_struct { 782pub fn some_fn(val: test_struct) -> test_struct {
783 test_struct { one: val.one + 1 } 783 test_struct { one: val.one + 1 }
@@ -794,7 +794,7 @@ pub fn some_fn(val: TestStruct) -> TestStruct {
794 794
795 check_fix( 795 check_fix(
796 r#" 796 r#"
797pub fn some_fn(NonSnakeCase<|>: u8) -> u8 { 797pub fn some_fn(NonSnakeCase$0: u8) -> u8 {
798 NonSnakeCase 798 NonSnakeCase
799} 799}
800"#, 800"#,
@@ -807,7 +807,7 @@ pub fn some_fn(non_snake_case: u8) -> u8 {
807 807
808 check_fix( 808 check_fix(
809 r#" 809 r#"
810pub fn SomeFn<|>(val: u8) -> u8 { 810pub fn SomeFn$0(val: u8) -> u8 {
811 if val != 0 { SomeFn(val - 1) } else { val } 811 if val != 0 { SomeFn(val - 1) } else { val }
812} 812}
813"#, 813"#,
@@ -821,7 +821,7 @@ pub fn some_fn(val: u8) -> u8 {
821 check_fix( 821 check_fix(
822 r#" 822 r#"
823fn some_fn() { 823fn some_fn() {
824 let whatAWeird_Formatting<|> = 10; 824 let whatAWeird_Formatting$0 = 10;
825 another_func(whatAWeird_Formatting); 825 another_func(whatAWeird_Formatting);
826} 826}
827"#, 827"#,
@@ -839,7 +839,7 @@ fn some_fn() {
839 check_no_diagnostics( 839 check_no_diagnostics(
840 r#" 840 r#"
841fn foo() { 841fn foo() {
842 const ANOTHER_ITEM<|>: &str = "some_item"; 842 const ANOTHER_ITEM$0: &str = "some_item";
843} 843}
844"#, 844"#,
845 ); 845 );
@@ -852,7 +852,7 @@ fn foo() {
852pub struct TestStruct; 852pub struct TestStruct;
853 853
854impl TestStruct { 854impl TestStruct {
855 pub fn SomeFn<|>() -> TestStruct { 855 pub fn SomeFn$0() -> TestStruct {
856 TestStruct 856 TestStruct
857 } 857 }
858} 858}
@@ -871,7 +871,7 @@ impl TestStruct {
871 871
872 #[test] 872 #[test]
873 fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() { 873 fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() {
874 let input = r#"fn FOO<|>() {}"#; 874 let input = r#"fn FOO$0() {}"#;
875 let expected = r#"fn foo() {}"#; 875 let expected = r#"fn foo() {}"#;
876 876
877 let (analysis, file_position) = fixture::position(input); 877 let (analysis, file_position) = fixture::position(input);