aboutsummaryrefslogtreecommitdiff
path: root/crates/ide/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide/src')
-rw-r--r--crates/ide/src/goto_type_definition.rs2
-rw-r--r--crates/ide/src/hover.rs29
-rw-r--r--crates/ide/src/inlay_hints.rs21
3 files changed, 23 insertions, 29 deletions
diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs
index ca3c02bf6..43cffefe5 100644
--- a/crates/ide/src/goto_type_definition.rs
+++ b/crates/ide/src/goto_type_definition.rs
@@ -25,7 +25,7 @@ pub(crate) fn goto_type_definition(
25 let token: SyntaxToken = pick_best(file.syntax().token_at_offset(position.offset))?; 25 let token: SyntaxToken = pick_best(file.syntax().token_at_offset(position.offset))?;
26 let token: SyntaxToken = sema.descend_into_macros(token); 26 let token: SyntaxToken = sema.descend_into_macros(token);
27 27
28 let (ty, node) = sema.token_ancestors_with_macros(token.clone()).find_map(|node| { 28 let (ty, node) = sema.token_ancestors_with_macros(token).find_map(|node| {
29 let ty = match_ast! { 29 let ty = match_ast! {
30 match node { 30 match node {
31 ast::Expr(it) => sema.type_of_expr(&it)?, 31 ast::Expr(it) => sema.type_of_expr(&it)?,
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 01dd0c0da..05a2b1293 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -568,8 +568,6 @@ mod tests {
568 568
569 use crate::fixture; 569 use crate::fixture;
570 570
571 use super::*;
572
573 fn check_hover_no_result(ra_fixture: &str) { 571 fn check_hover_no_result(ra_fixture: &str) {
574 let (analysis, position) = fixture::position(ra_fixture); 572 let (analysis, position) = fixture::position(ra_fixture);
575 assert!(analysis.hover(position, true, true).unwrap().is_none()); 573 assert!(analysis.hover(position, true, true).unwrap().is_none());
@@ -3016,8 +3014,8 @@ fn foo() {
3016 file_id: FileId( 3014 file_id: FileId(
3017 1, 3015 1,
3018 ), 3016 ),
3019 full_range: 247..429, 3017 full_range: 251..433,
3020 focus_range: 286..292, 3018 focus_range: 290..296,
3021 name: "Future", 3019 name: "Future",
3022 kind: Trait, 3020 kind: Trait,
3023 description: "pub trait Future", 3021 description: "pub trait Future",
@@ -3813,11 +3811,14 @@ use foo::bar::{self$0};
3813 3811
3814 #[test] 3812 #[test]
3815 fn hover_keyword() { 3813 fn hover_keyword() {
3816 let ra_fixture = r#"//- /main.rs crate:main deps:std
3817fn f() { retur$0n; }"#;
3818 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3819 check( 3814 check(
3820 &fixture, 3815 r#"
3816//- /main.rs crate:main deps:std
3817fn f() { retur$0n; }
3818//- /libstd.rs crate:std
3819/// Docs for return_keyword
3820mod return_keyword {}
3821"#,
3821 expect![[r#" 3822 expect![[r#"
3822 *return* 3823 *return*
3823 3824
@@ -3834,11 +3835,15 @@ fn f() { retur$0n; }"#;
3834 3835
3835 #[test] 3836 #[test]
3836 fn hover_builtin() { 3837 fn hover_builtin() {
3837 let ra_fixture = r#"//- /main.rs crate:main deps:std
3838cosnt _: &str$0 = ""; }"#;
3839 let fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
3840 check( 3838 check(
3841 &fixture, 3839 r#"
3840//- /main.rs crate:main deps:std
3841cosnt _: &str$0 = ""; }
3842
3843//- /libstd.rs crate:std
3844/// Docs for prim_str
3845mod prim_str {}
3846"#,
3842 expect![[r#" 3847 expect![[r#"
3843 *str* 3848 *str*
3844 3849
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 335d57a0d..95f9edce4 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -661,9 +661,7 @@ fn main() {
661 fn function_call_parameter_hint() { 661 fn function_call_parameter_hint() {
662 check_params( 662 check_params(
663 r#" 663 r#"
664enum Option<T> { None, Some(T) } 664//- minicore: option
665use Option::*;
666
667struct FileId {} 665struct FileId {}
668struct SmolStr {} 666struct SmolStr {}
669 667
@@ -872,7 +870,6 @@ fn main() {
872 check_types( 870 check_types(
873 r#" 871 r#"
874//- minicore: fn, sized 872//- minicore: fn, sized
875
876fn foo() -> impl Fn() { loop {} } 873fn foo() -> impl Fn() { loop {} }
877fn foo1() -> impl Fn(f64) { loop {} } 874fn foo1() -> impl Fn(f64) { loop {} }
878fn foo2() -> impl Fn(f64, f64) { loop {} } 875fn foo2() -> impl Fn(f64, f64) { loop {} }
@@ -908,9 +905,7 @@ fn main() {
908 fn unit_structs_have_no_type_hints() { 905 fn unit_structs_have_no_type_hints() {
909 check_types( 906 check_types(
910 r#" 907 r#"
911enum Result<T, E> { Ok(T), Err(E) } 908//- minicore: result
912use Result::*;
913
914struct SyntheticSyntax; 909struct SyntheticSyntax;
915 910
916fn main() { 911fn main() {
@@ -962,9 +957,7 @@ fn main() {
962 fn if_expr() { 957 fn if_expr() {
963 check_types( 958 check_types(
964 r#" 959 r#"
965enum Option<T> { None, Some(T) } 960//- minicore: option
966use Option::*;
967
968struct Test { a: Option<u32>, b: u8 } 961struct Test { a: Option<u32>, b: u8 }
969 962
970fn main() { 963fn main() {
@@ -994,9 +987,7 @@ fn main() {
994 fn while_expr() { 987 fn while_expr() {
995 check_types( 988 check_types(
996 r#" 989 r#"
997enum Option<T> { None, Some(T) } 990//- minicore: option
998use Option::*;
999
1000struct Test { a: Option<u32>, b: u8 } 991struct Test { a: Option<u32>, b: u8 }
1001 992
1002fn main() { 993fn main() {
@@ -1012,9 +1003,7 @@ fn main() {
1012 fn match_arm_list() { 1003 fn match_arm_list() {
1013 check_types( 1004 check_types(
1014 r#" 1005 r#"
1015enum Option<T> { None, Some(T) } 1006//- minicore: option
1016use Option::*;
1017
1018struct Test { a: Option<u32>, b: u8 } 1007struct Test { a: Option<u32>, b: u8 }
1019 1008
1020fn main() { 1009fn main() {