From 59fe884ef5ea2e0939d6a29c64c061569c0690bb Mon Sep 17 00:00:00 2001 From: cynecx Date: Sat, 2 Jan 2021 20:48:39 +0100 Subject: Fix warnings on rust-nightly --- crates/assists/src/utils.rs | 2 +- crates/rust-analyzer/src/config.rs | 2 +- crates/syntax/src/ast/edit.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'crates') diff --git a/crates/assists/src/utils.rs b/crates/assists/src/utils.rs index d41084b59..5a6125534 100644 --- a/crates/assists/src/utils.rs +++ b/crates/assists/src/utils.rs @@ -94,7 +94,7 @@ pub fn filter_assoc_items( ast::AssocItem::MacroCall(_) => None, } .is_some() - }; + } items .iter() diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 1db5b4e7d..685a9fdf0 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -679,7 +679,7 @@ fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json: for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) { fn key(f: &str) -> &str { f.splitn(2, "_").next().unwrap() - }; + } assert!(key(f1) <= key(f2), "wrong field order: {:?} {:?}", f1, f2); } diff --git a/crates/syntax/src/ast/edit.rs b/crates/syntax/src/ast/edit.rs index 77233ab31..824ebf41c 100644 --- a/crates/syntax/src/ast/edit.rs +++ b/crates/syntax/src/ast/edit.rs @@ -220,7 +220,7 @@ impl ast::RecordExprFieldList { InsertPosition::After($anchor.syntax().clone().into()) } }; - }; + } let position = match position { InsertPosition::First => after_l_curly!(), @@ -533,7 +533,7 @@ impl ast::GenericParamList { InsertPosition::After($anchor.syntax().clone().into()) } }; - }; + } let position = match self.generic_params().last() { Some(it) => after_field!(it), -- cgit v1.2.3 From 3e9847f7474b0df893351e4e1fe57dcb6f6171bd Mon Sep 17 00:00:00 2001 From: cynecx Date: Sat, 2 Jan 2021 20:58:06 +0100 Subject: Use fully qualified `Itertools::intersperse` call to silence nightly warnings about a potential name collision due to recent libstd api additions --- crates/hir_def/src/attr.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/hir_def/src/attr.rs b/crates/hir_def/src/attr.rs index 042e119b1..fcf638e0f 100644 --- a/crates/hir_def/src/attr.rs +++ b/crates/hir_def/src/attr.rs @@ -260,14 +260,13 @@ impl Attrs { } pub fn docs(&self) -> Option { - let docs = self - .by_key("doc") - .attrs() - .flat_map(|attr| match attr.input.as_ref()? { - AttrInput::Literal(s) => Some(s), - AttrInput::TokenTree(_) => None, - }) - .intersperse(&SmolStr::new_inline("\n")) + let docs = self.by_key("doc").attrs().flat_map(|attr| match attr.input.as_ref()? { + AttrInput::Literal(s) => Some(s), + AttrInput::TokenTree(_) => None, + }); + // FIXME: Replace `Itertools::intersperse` with `Iterator::intersperse[_with]` until the + // libstd api gets stabilized (https://github.com/rust-lang/rust/issues/79524). + let docs = Itertools::intersperse(docs, &SmolStr::new_inline("\n")) .map(|it| it.as_str()) .collect::(); if docs.is_empty() { -- cgit v1.2.3