Use array into_iter in more places
This commit is contained in:
parent
71f5dae4b6
commit
139bf9b4e1
@ -21,8 +21,7 @@ pub(super) fn parse_intra_doc_link(s: &str) -> (&str, Option<hir::Namespace>) {
|
||||
(hir::Namespace::Values, (VALUES.0.iter(), VALUES.1.iter())),
|
||||
(hir::Namespace::Macros, (MACROS.0.iter(), MACROS.1.iter())),
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
.into_iter()
|
||||
.find_map(|(ns, (mut prefixes, mut suffixes))| {
|
||||
if let Some(prefix) = prefixes.find(|&&prefix| {
|
||||
s.starts_with(prefix)
|
||||
@ -42,8 +41,7 @@ pub(super) fn strip_prefixes_suffixes(s: &str) -> &str {
|
||||
(VALUES.0.iter(), VALUES.1.iter()),
|
||||
(MACROS.0.iter(), MACROS.1.iter()),
|
||||
]
|
||||
.iter()
|
||||
.cloned()
|
||||
.into_iter()
|
||||
.find_map(|(mut prefixes, mut suffixes)| {
|
||||
if let Some(prefix) = prefixes.find(|&&prefix| {
|
||||
s.starts_with(prefix)
|
||||
|
@ -226,7 +226,7 @@ fn find_imported_defs(ctx: &AssistContext, star: SyntaxToken) -> Option<Vec<Def>
|
||||
|
||||
Some(
|
||||
[Direction::Prev, Direction::Next]
|
||||
.iter()
|
||||
.into_iter()
|
||||
.flat_map(|dir| {
|
||||
parent_use_item_syntax
|
||||
.siblings(dir.to_owned())
|
||||
|
@ -105,7 +105,7 @@ fn generate_lint_descriptor(buf: &mut String) {
|
||||
|
||||
fn generate_feature_descriptor(buf: &mut String, src_dir: &Path) {
|
||||
let mut features = ["language-features", "library-features"]
|
||||
.iter()
|
||||
.into_iter()
|
||||
.flat_map(|it| sourcegen::list_files(&src_dir.join(it)))
|
||||
.filter(|path| {
|
||||
// Get all `.md ` files
|
||||
|
@ -43,8 +43,7 @@ pub fn public_deps(&self) -> impl Iterator<Item = (&'static str, SysrootCrate, b
|
||||
// core is added as a dependency before std in order to
|
||||
// mimic rustcs dependency order
|
||||
["core", "alloc", "std"]
|
||||
.iter()
|
||||
.copied()
|
||||
.into_iter()
|
||||
.zip(iter::repeat(true))
|
||||
.chain(iter::once(("test", false)))
|
||||
.filter_map(move |(name, prelude)| Some((name, self.by_name(name)?, prelude)))
|
||||
@ -78,7 +77,7 @@ pub fn load(sysroot_src_dir: AbsPathBuf) -> Result<Sysroot> {
|
||||
for path in SYSROOT_CRATES.trim().lines() {
|
||||
let name = path.split('/').last().unwrap();
|
||||
let root = [format!("{}/src/lib.rs", path), format!("lib{}/lib.rs", path)]
|
||||
.iter()
|
||||
.into_iter()
|
||||
.map(|it| sysroot.root.join(it))
|
||||
.filter_map(|it| ManifestPath::try_from(it).ok())
|
||||
.find(|it| fs::metadata(it).is_ok());
|
||||
|
@ -212,8 +212,8 @@ fn send_request_(&self, r: Request) -> Value {
|
||||
if req.method == "client/registerCapability" {
|
||||
let params = req.params.to_string();
|
||||
if ["workspace/didChangeWatchedFiles", "textDocument/didSave"]
|
||||
.iter()
|
||||
.any(|&it| params.contains(it))
|
||||
.into_iter()
|
||||
.any(|it| params.contains(it))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user