aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/assists/src/utils.rs23
-rw-r--r--crates/ide/src/inlay_hints.rs28
2 files changed, 20 insertions, 31 deletions
diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs
index 0335969fd..b341453d4 100644
--- a/crates/assists/src/utils.rs
+++ b/crates/assists/src/utils.rs
@@ -286,14 +286,21 @@ pub mod convert {
286} 286}
287 287
288pub mod iter { 288pub mod iter {
289 pub use self::traits::iterator::Iterator; 289 pub use self::traits::{collect::IntoIterator, iterator::Iterator};
290 mod traits { mod iterator { 290 mod traits {
291 use crate::option::Option; 291 mod iterator {
292 pub trait Iterator { 292 use crate::option::Option;
293 type Item; 293 pub trait Iterator {
294 fn next(&mut self) -> Option<Self::Item>; 294 type Item;
295 fn next(&mut self) -> Option<Self::Item>;
296 }
297 }
298 mod collect {
299 pub trait IntoIterator {
300 type Item;
301 }
295 } 302 }
296 } } 303 }
297 304
298 pub use self::sources::*; 305 pub use self::sources::*;
299 mod sources { 306 mod sources {
@@ -321,7 +328,7 @@ pub mod option {
321} 328}
322 329
323pub mod prelude { 330pub mod prelude {
324 pub use crate::{convert::From, iter::Iterator, option::Option::{self, *}}; 331 pub use crate::{convert::From, iter::{IntoIterator, Iterator}, option::Option::{self, *}};
325} 332}
326#[prelude_import] 333#[prelude_import]
327pub use prelude::*; 334pub use prelude::*;
diff --git a/crates/ide/src/inlay_hints.rs b/crates/ide/src/inlay_hints.rs
index 27bd1e37f..31a6a1be8 100644
--- a/crates/ide/src/inlay_hints.rs
+++ b/crates/ide/src/inlay_hints.rs
@@ -412,7 +412,8 @@ mod tests {
412 } 412 }
413 413
414 fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) { 414 fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) {
415 let (analysis, file_id) = fixture::file(ra_fixture); 415 let ra_fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
416 let (analysis, file_id) = fixture::file(&ra_fixture);
416 let expected = extract_annotations(&*analysis.file_text(file_id).unwrap()); 417 let expected = extract_annotations(&*analysis.file_text(file_id).unwrap());
417 let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap(); 418 let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap();
418 let actual = 419 let actual =
@@ -1011,13 +1012,6 @@ fn main() {
1011 println!("Unit expr"); 1012 println!("Unit expr");
1012} 1013}
1013 1014
1014//- /core.rs crate:core
1015#[prelude_import] use iter::*;
1016mod iter {
1017 trait IntoIterator {
1018 type Item;
1019 }
1020}
1021//- /alloc.rs crate:alloc deps:core 1015//- /alloc.rs crate:alloc deps:core
1022mod collections { 1016mod collections {
1023 struct Vec<T> {} 1017 struct Vec<T> {}
@@ -1059,14 +1053,6 @@ fn main() {
1059 //^ &str 1053 //^ &str
1060 } 1054 }
1061} 1055}
1062
1063//- /core.rs crate:core
1064#[prelude_import] use iter::*;
1065mod iter {
1066 trait IntoIterator {
1067 type Item;
1068 }
1069}
1070//- /alloc.rs crate:alloc deps:core 1056//- /alloc.rs crate:alloc deps:core
1071mod collections { 1057mod collections {
1072 struct Vec<T> {} 1058 struct Vec<T> {}
@@ -1125,15 +1111,13 @@ fn main() {
1125 chaining_hints: true, 1111 chaining_hints: true,
1126 max_length: None, 1112 max_length: None,
1127 }, 1113 },
1128 &format!( 1114 r#"
1129 "{}\n{}\n",
1130 r#"
1131//- /main.rs crate:main deps:std 1115//- /main.rs crate:main deps:std
1132use std::{Option::{self, Some, None}, iter}; 1116use std::iter;
1133 1117
1134struct MyIter; 1118struct MyIter;
1135 1119
1136impl iter::Iterator for MyIter { 1120impl Iterator for MyIter {
1137 type Item = (); 1121 type Item = ();
1138 fn next(&mut self) -> Option<Self::Item> { 1122 fn next(&mut self) -> Option<Self::Item> {
1139 None 1123 None
@@ -1154,8 +1138,6 @@ fn main() {
1154//- /std.rs crate:std deps:core 1138//- /std.rs crate:std deps:core
1155use core::*; 1139use core::*;
1156"#, 1140"#,
1157 FamousDefs::FIXTURE
1158 ),
1159 ); 1141 );
1160 } 1142 }
1161} 1143}