aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/assists/src/utils.rs2
-rw-r--r--crates/hir_def/src/attr.rs15
-rw-r--r--crates/rust-analyzer/src/config.rs2
-rw-r--r--crates/syntax/src/ast/edit.rs4
4 files changed, 11 insertions, 12 deletions
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(
94 ast::AssocItem::MacroCall(_) => None, 94 ast::AssocItem::MacroCall(_) => None,
95 } 95 }
96 .is_some() 96 .is_some()
97 }; 97 }
98 98
99 items 99 items
100 .iter() 100 .iter()
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 {
260 } 260 }
261 261
262 pub fn docs(&self) -> Option<Documentation> { 262 pub fn docs(&self) -> Option<Documentation> {
263 let docs = self 263 let docs = self.by_key("doc").attrs().flat_map(|attr| match attr.input.as_ref()? {
264 .by_key("doc") 264 AttrInput::Literal(s) => Some(s),
265 .attrs() 265 AttrInput::TokenTree(_) => None,
266 .flat_map(|attr| match attr.input.as_ref()? { 266 });
267 AttrInput::Literal(s) => Some(s), 267 // FIXME: Replace `Itertools::intersperse` with `Iterator::intersperse[_with]` until the
268 AttrInput::TokenTree(_) => None, 268 // libstd api gets stabilized (https://github.com/rust-lang/rust/issues/79524).
269 }) 269 let docs = Itertools::intersperse(docs, &SmolStr::new_inline("\n"))
270 .intersperse(&SmolStr::new_inline("\n"))
271 .map(|it| it.as_str()) 270 .map(|it| it.as_str())
272 .collect::<String>(); 271 .collect::<String>();
273 if docs.is_empty() { 272 if docs.is_empty() {
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:
679 for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) { 679 for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) {
680 fn key(f: &str) -> &str { 680 fn key(f: &str) -> &str {
681 f.splitn(2, "_").next().unwrap() 681 f.splitn(2, "_").next().unwrap()
682 }; 682 }
683 assert!(key(f1) <= key(f2), "wrong field order: {:?} {:?}", f1, f2); 683 assert!(key(f1) <= key(f2), "wrong field order: {:?} {:?}", f1, f2);
684 } 684 }
685 685
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 {
220 InsertPosition::After($anchor.syntax().clone().into()) 220 InsertPosition::After($anchor.syntax().clone().into())
221 } 221 }
222 }; 222 };
223 }; 223 }
224 224
225 let position = match position { 225 let position = match position {
226 InsertPosition::First => after_l_curly!(), 226 InsertPosition::First => after_l_curly!(),
@@ -533,7 +533,7 @@ impl ast::GenericParamList {
533 InsertPosition::After($anchor.syntax().clone().into()) 533 InsertPosition::After($anchor.syntax().clone().into())
534 } 534 }
535 }; 535 };
536 }; 536 }
537 537
538 let position = match self.generic_params().last() { 538 let position = match self.generic_params().last() {
539 Some(it) => after_field!(it), 539 Some(it) => after_field!(it),