mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 09:27:27 +00:00
Move IntoIterator into FamousDefs
This commit is contained in:
parent
c6f1de6ac5
commit
c133651e0a
2 changed files with 20 additions and 31 deletions
|
@ -286,14 +286,21 @@ pub mod convert {
|
|||
}
|
||||
|
||||
pub mod iter {
|
||||
pub use self::traits::iterator::Iterator;
|
||||
mod traits { mod iterator {
|
||||
use crate::option::Option;
|
||||
pub trait Iterator {
|
||||
type Item;
|
||||
fn next(&mut self) -> Option<Self::Item>;
|
||||
pub use self::traits::{collect::IntoIterator, iterator::Iterator};
|
||||
mod traits {
|
||||
mod iterator {
|
||||
use crate::option::Option;
|
||||
pub trait Iterator {
|
||||
type Item;
|
||||
fn next(&mut self) -> Option<Self::Item>;
|
||||
}
|
||||
}
|
||||
} }
|
||||
mod collect {
|
||||
pub trait IntoIterator {
|
||||
type Item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub use self::sources::*;
|
||||
mod sources {
|
||||
|
@ -321,7 +328,7 @@ pub mod option {
|
|||
}
|
||||
|
||||
pub mod prelude {
|
||||
pub use crate::{convert::From, iter::Iterator, option::Option::{self, *}};
|
||||
pub use crate::{convert::From, iter::{IntoIterator, Iterator}, option::Option::{self, *}};
|
||||
}
|
||||
#[prelude_import]
|
||||
pub use prelude::*;
|
||||
|
|
|
@ -412,7 +412,8 @@ mod tests {
|
|||
}
|
||||
|
||||
fn check_with_config(config: InlayHintsConfig, ra_fixture: &str) {
|
||||
let (analysis, file_id) = fixture::file(ra_fixture);
|
||||
let ra_fixture = format!("{}\n{}", ra_fixture, FamousDefs::FIXTURE);
|
||||
let (analysis, file_id) = fixture::file(&ra_fixture);
|
||||
let expected = extract_annotations(&*analysis.file_text(file_id).unwrap());
|
||||
let inlay_hints = analysis.inlay_hints(file_id, &config).unwrap();
|
||||
let actual =
|
||||
|
@ -1011,13 +1012,6 @@ fn main() {
|
|||
println!("Unit expr");
|
||||
}
|
||||
|
||||
//- /core.rs crate:core
|
||||
#[prelude_import] use iter::*;
|
||||
mod iter {
|
||||
trait IntoIterator {
|
||||
type Item;
|
||||
}
|
||||
}
|
||||
//- /alloc.rs crate:alloc deps:core
|
||||
mod collections {
|
||||
struct Vec<T> {}
|
||||
|
@ -1059,14 +1053,6 @@ fn main() {
|
|||
//^ &str
|
||||
}
|
||||
}
|
||||
|
||||
//- /core.rs crate:core
|
||||
#[prelude_import] use iter::*;
|
||||
mod iter {
|
||||
trait IntoIterator {
|
||||
type Item;
|
||||
}
|
||||
}
|
||||
//- /alloc.rs crate:alloc deps:core
|
||||
mod collections {
|
||||
struct Vec<T> {}
|
||||
|
@ -1125,15 +1111,13 @@ fn main() {
|
|||
chaining_hints: true,
|
||||
max_length: None,
|
||||
},
|
||||
&format!(
|
||||
"{}\n{}\n",
|
||||
r#"
|
||||
r#"
|
||||
//- /main.rs crate:main deps:std
|
||||
use std::{Option::{self, Some, None}, iter};
|
||||
use std::iter;
|
||||
|
||||
struct MyIter;
|
||||
|
||||
impl iter::Iterator for MyIter {
|
||||
impl Iterator for MyIter {
|
||||
type Item = ();
|
||||
fn next(&mut self) -> Option<Self::Item> {
|
||||
None
|
||||
|
@ -1154,8 +1138,6 @@ fn main() {
|
|||
//- /std.rs crate:std deps:core
|
||||
use core::*;
|
||||
"#,
|
||||
FamousDefs::FIXTURE
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue