aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/expect/src/lib.rs2
-rw-r--r--crates/ra_mbe/src/mbe_expander/matcher.rs2
-rw-r--r--crates/ra_proc_macro/src/process.rs2
-rw-r--r--crates/ra_text_edit/src/lib.rs13
-rw-r--r--crates/ra_tt/src/lib.rs2
-rw-r--r--crates/stdx/src/lib.rs4
6 files changed, 15 insertions, 10 deletions
diff --git a/crates/expect/src/lib.rs b/crates/expect/src/lib.rs
index 21a458d47..bd83895f7 100644
--- a/crates/expect/src/lib.rs
+++ b/crates/expect/src/lib.rs
@@ -74,7 +74,7 @@ impl fmt::Display for Position {
74impl Expect { 74impl Expect {
75 pub fn assert_eq(&self, actual: &str) { 75 pub fn assert_eq(&self, actual: &str) {
76 let trimmed = self.trimmed(); 76 let trimmed = self.trimmed();
77 if &trimmed == actual { 77 if trimmed == actual {
78 return; 78 return;
79 } 79 }
80 Runtime::fail_expect(self, &trimmed, actual); 80 Runtime::fail_expect(self, &trimmed, actual);
diff --git a/crates/ra_mbe/src/mbe_expander/matcher.rs b/crates/ra_mbe/src/mbe_expander/matcher.rs
index f9e515b81..933a3a3b5 100644
--- a/crates/ra_mbe/src/mbe_expander/matcher.rs
+++ b/crates/ra_mbe/src/mbe_expander/matcher.rs
@@ -276,7 +276,7 @@ impl<'a> TtIter<'a> {
276 Ok(tt::Subtree { 276 Ok(tt::Subtree {
277 delimiter: None, 277 delimiter: None,
278 token_trees: vec![ 278 token_trees: vec![
279 tt::Leaf::Punct(punct.clone()).into(), 279 tt::Leaf::Punct(*punct).into(),
280 tt::Leaf::Ident(ident.clone()).into(), 280 tt::Leaf::Ident(ident.clone()).into(),
281 ], 281 ],
282 } 282 }
diff --git a/crates/ra_proc_macro/src/process.rs b/crates/ra_proc_macro/src/process.rs
index 5bcdacb48..37dd3f496 100644
--- a/crates/ra_proc_macro/src/process.rs
+++ b/crates/ra_proc_macro/src/process.rs
@@ -90,7 +90,7 @@ impl ProcMacroProcessSrv {
90 } 90 }
91 Some(it) => it, 91 Some(it) => it,
92 }; 92 };
93 sender.send(Task { req: req.into(), result_tx }).unwrap(); 93 sender.send(Task { req, result_tx }).unwrap();
94 let res = result_rx 94 let res = result_rx
95 .recv() 95 .recv()
96 .map_err(|_| ra_tt::ExpansionError::Unknown("Proc macro thread is closed.".into()))?; 96 .map_err(|_| ra_tt::ExpansionError::Unknown("Proc macro thread is closed.".into()))?;
diff --git a/crates/ra_text_edit/src/lib.rs b/crates/ra_text_edit/src/lib.rs
index 25554f583..d68791cf1 100644
--- a/crates/ra_text_edit/src/lib.rs
+++ b/crates/ra_text_edit/src/lib.rs
@@ -76,10 +76,6 @@ impl TextEdit {
76 self.indels.iter() 76 self.indels.iter()
77 } 77 }
78 78
79 pub fn into_iter(self) -> vec::IntoIter<Indel> {
80 self.indels.into_iter()
81 }
82
83 pub fn apply(&self, text: &mut String) { 79 pub fn apply(&self, text: &mut String) {
84 match self.len() { 80 match self.len() {
85 0 => return, 81 0 => return,
@@ -141,6 +137,15 @@ impl TextEdit {
141 } 137 }
142} 138}
143 139
140impl IntoIterator for TextEdit {
141 type Item = Indel;
142 type IntoIter = vec::IntoIter<Self::Item>;
143
144 fn into_iter(self) -> Self::IntoIter {
145 self.indels.into_iter()
146 }
147}
148
144impl TextEditBuilder { 149impl TextEditBuilder {
145 pub fn replace(&mut self, range: TextRange, replace_with: String) { 150 pub fn replace(&mut self, range: TextRange, replace_with: String) {
146 self.indels.push(Indel::replace(range, replace_with)) 151 self.indels.push(Indel::replace(range, replace_with))
diff --git a/crates/ra_tt/src/lib.rs b/crates/ra_tt/src/lib.rs
index 8faf1cc67..20c3f5eab 100644
--- a/crates/ra_tt/src/lib.rs
+++ b/crates/ra_tt/src/lib.rs
@@ -107,7 +107,7 @@ fn print_debug_subtree(f: &mut fmt::Formatter<'_>, subtree: &Subtree, level: usi
107 for (idx, child) in subtree.token_trees.iter().enumerate() { 107 for (idx, child) in subtree.token_trees.iter().enumerate() {
108 print_debug_token(f, child, level + 1)?; 108 print_debug_token(f, child, level + 1)?;
109 if idx != subtree.token_trees.len() - 1 { 109 if idx != subtree.token_trees.len() - 1 {
110 writeln!(f, "")?; 110 writeln!(f)?;
111 } 111 }
112 } 112 }
113 } 113 }
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs
index b65875c96..00bfcd29e 100644
--- a/crates/stdx/src/lib.rs
+++ b/crates/stdx/src/lib.rs
@@ -10,7 +10,7 @@ pub fn is_ci() -> bool {
10 10
11pub trait SepBy: Sized { 11pub trait SepBy: Sized {
12 /// Returns an `impl fmt::Display`, which joins elements via a separator. 12 /// Returns an `impl fmt::Display`, which joins elements via a separator.
13 fn sep_by<'a>(self, sep: &'a str) -> SepByBuilder<'a, Self>; 13 fn sep_by(self, sep: &str) -> SepByBuilder<'_, Self>;
14} 14}
15 15
16impl<I> SepBy for I 16impl<I> SepBy for I
@@ -18,7 +18,7 @@ where
18 I: Iterator, 18 I: Iterator,
19 I::Item: fmt::Display, 19 I::Item: fmt::Display,
20{ 20{
21 fn sep_by<'a>(self, sep: &'a str) -> SepByBuilder<'a, Self> { 21 fn sep_by(self, sep: &str) -> SepByBuilder<'_, Self> {
22 SepByBuilder::new(sep, self) 22 SepByBuilder::new(sep, self)
23 } 23 }
24} 24}