Skip to content

Commit c133651

Browse files
committed
Move IntoIterator into FamousDefs
1 parent c6f1de6 commit c133651

File tree

2 files changed

+20
-31
lines changed

2 files changed

+20
-31
lines changed

crates/assists/src/utils.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,21 @@ pub mod convert {
286286
}
287287
288288
pub mod iter {
289-
pub use self::traits::iterator::Iterator;
290-
mod traits { mod iterator {
291-
use crate::option::Option;
292-
pub trait Iterator {
293-
type Item;
294-
fn next(&mut self) -> Option<Self::Item>;
289+
pub use self::traits::{collect::IntoIterator, iterator::Iterator};
290+
mod traits {
291+
mod iterator {
292+
use crate::option::Option;
293+
pub trait Iterator {
294+
type Item;
295+
fn next(&mut self) -> Option<Self::Item>;
296+
}
297+
}
298+
mod collect {
299+
pub trait IntoIterator {
300+
type Item;
301+
}
295302
}
296-
} }
303+
}
297304
298305
pub use self::sources::*;
299306
mod sources {
@@ -321,7 +328,7 @@ pub mod option {
321328
}
322329
323330
pub 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, *}};
325332
}
326333
#[prelude_import]
327334
pub use prelude::*;

crates/ide/src/inlay_hints.rs

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,8 @@ mod tests {
412412
}
413413

414414
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);
416417
let expected = extract_annotations(&*analysis.file_text(file_id).unwrap());
417418
let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap();
418419
let actual =
@@ -1011,13 +1012,6 @@ fn main() {
10111012
println!("Unit expr");
10121013
}
10131014
1014-
//- /core.rs crate:core
1015-
#[prelude_import] use iter::*;
1016-
mod iter {
1017-
trait IntoIterator {
1018-
type Item;
1019-
}
1020-
}
10211015
//- /alloc.rs crate:alloc deps:core
10221016
mod collections {
10231017
struct Vec<T> {}
@@ -1059,14 +1053,6 @@ fn main() {
10591053
//^ &str
10601054
}
10611055
}
1062-
1063-
//- /core.rs crate:core
1064-
#[prelude_import] use iter::*;
1065-
mod iter {
1066-
trait IntoIterator {
1067-
type Item;
1068-
}
1069-
}
10701056
//- /alloc.rs crate:alloc deps:core
10711057
mod collections {
10721058
struct Vec<T> {}
@@ -1125,15 +1111,13 @@ fn main() {
11251111
chaining_hints: true,
11261112
max_length: None,
11271113
},
1128-
&format!(
1129-
"{}\n{}\n",
1130-
r#"
1114+
r#"
11311115
//- /main.rs crate:main deps:std
1132-
use std::{Option::{self, Some, None}, iter};
1116+
use std::iter;
11331117
11341118
struct MyIter;
11351119
1136-
impl iter::Iterator for MyIter {
1120+
impl Iterator for MyIter {
11371121
type Item = ();
11381122
fn next(&mut self) -> Option<Self::Item> {
11391123
None
@@ -1154,8 +1138,6 @@ fn main() {
11541138
//- /std.rs crate:std deps:core
11551139
use core::*;
11561140
"#,
1157-
FamousDefs::FIXTURE
1158-
),
11591141
);
11601142
}
11611143
}

0 commit comments

Comments
 (0)