diff options
Diffstat (limited to 'crates/ra_mbe')
-rw-r--r-- | crates/ra_mbe/src/mbe_expander.rs | 2 | ||||
-rw-r--r-- | crates/ra_mbe/src/mbe_parser.rs | 2 | ||||
-rw-r--r-- | crates/ra_mbe/src/subtree_source.rs | 2 | ||||
-rw-r--r-- | crates/ra_mbe/src/syntax_bridge.rs | 2 | ||||
-rw-r--r-- | crates/ra_mbe/src/tt_cursor.rs | 12 |
5 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_mbe/src/mbe_expander.rs b/crates/ra_mbe/src/mbe_expander.rs index fbad8ebe2..c7c06c7fd 100644 --- a/crates/ra_mbe/src/mbe_expander.rs +++ b/crates/ra_mbe/src/mbe_expander.rs | |||
@@ -498,7 +498,7 @@ fn expand_tt( | |||
498 | tt::Leaf::from(tt::Ident { text: ident.text.clone(), id: TokenId::unspecified() }) | 498 | tt::Leaf::from(tt::Ident { text: ident.text.clone(), id: TokenId::unspecified() }) |
499 | .into() | 499 | .into() |
500 | } | 500 | } |
501 | crate::Leaf::Punct(punct) => tt::Leaf::from(punct.clone()).into(), | 501 | crate::Leaf::Punct(punct) => tt::Leaf::from(*punct).into(), |
502 | crate::Leaf::Var(v) => { | 502 | crate::Leaf::Var(v) => { |
503 | if v.text == "crate" { | 503 | if v.text == "crate" { |
504 | // FIXME: Properly handle $crate token | 504 | // FIXME: Properly handle $crate token |
diff --git a/crates/ra_mbe/src/mbe_parser.rs b/crates/ra_mbe/src/mbe_parser.rs index a29885852..cddb4a7b4 100644 --- a/crates/ra_mbe/src/mbe_parser.rs +++ b/crates/ra_mbe/src/mbe_parser.rs | |||
@@ -56,7 +56,7 @@ fn parse_subtree(tt: &tt::Subtree, transcriber: bool) -> Result<crate::Subtree, | |||
56 | } | 56 | } |
57 | } | 57 | } |
58 | tt::Leaf::Punct(punct) => crate::Leaf::from(*punct).into(), | 58 | tt::Leaf::Punct(punct) => crate::Leaf::from(*punct).into(), |
59 | tt::Leaf::Ident(tt::Ident { text, id: _ }) => { | 59 | tt::Leaf::Ident(tt::Ident { text, .. }) => { |
60 | crate::Leaf::from(crate::Ident { text: text.clone() }).into() | 60 | crate::Leaf::from(crate::Ident { text: text.clone() }).into() |
61 | } | 61 | } |
62 | tt::Leaf::Literal(tt::Literal { text }) => { | 62 | tt::Leaf::Literal(tt::Literal { text }) => { |
diff --git a/crates/ra_mbe/src/subtree_source.rs b/crates/ra_mbe/src/subtree_source.rs index 2489c996b..e1c6e7d91 100644 --- a/crates/ra_mbe/src/subtree_source.rs +++ b/crates/ra_mbe/src/subtree_source.rs | |||
@@ -78,7 +78,7 @@ impl<'a> SubtreeTokenSource<'a> { | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | return cached[pos].clone(); | 81 | cached[pos].clone() |
82 | } | 82 | } |
83 | } | 83 | } |
84 | 84 | ||
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index b91b0e7a5..7560d215a 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -107,7 +107,7 @@ pub fn token_tree_to_ast_item_list(tt: &tt::Subtree) -> TreeArc<ast::SourceFile> | |||
107 | impl TokenMap { | 107 | impl TokenMap { |
108 | pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> { | 108 | pub fn relative_range_of(&self, tt: tt::TokenId) -> Option<TextRange> { |
109 | let idx = tt.0 as usize; | 109 | let idx = tt.0 as usize; |
110 | self.tokens.get(idx).map(|&it| it) | 110 | self.tokens.get(idx).copied() |
111 | } | 111 | } |
112 | 112 | ||
113 | fn alloc(&mut self, relative_range: TextRange) -> tt::TokenId { | 113 | fn alloc(&mut self, relative_range: TextRange) -> tt::TokenId { |
diff --git a/crates/ra_mbe/src/tt_cursor.rs b/crates/ra_mbe/src/tt_cursor.rs index 503c77ef3..8e360ce0f 100644 --- a/crates/ra_mbe/src/tt_cursor.rs +++ b/crates/ra_mbe/src/tt_cursor.rs | |||
@@ -171,14 +171,14 @@ impl<'a> TtCursor<'a> { | |||
171 | } | 171 | } |
172 | 172 | ||
173 | fn eat_punct3(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> { | 173 | fn eat_punct3(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> { |
174 | let sec = self.eat_punct()?.clone(); | 174 | let sec = *self.eat_punct()?; |
175 | let third = self.eat_punct()?.clone(); | 175 | let third = *self.eat_punct()?; |
176 | Some(smallvec![p.clone(), sec, third]) | 176 | Some(smallvec![*p, sec, third]) |
177 | } | 177 | } |
178 | 178 | ||
179 | fn eat_punct2(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> { | 179 | fn eat_punct2(&mut self, p: &tt::Punct) -> Option<SmallVec<[tt::Punct; 3]>> { |
180 | let sec = self.eat_punct()?.clone(); | 180 | let sec = *self.eat_punct()?; |
181 | Some(smallvec![p.clone(), sec]) | 181 | Some(smallvec![*p, sec]) |
182 | } | 182 | } |
183 | 183 | ||
184 | fn eat_multi_char_punct<'b, I>( | 184 | fn eat_multi_char_punct<'b, I>( |
@@ -251,7 +251,7 @@ impl<'a> TtCursor<'a> { | |||
251 | // So we by pass that check here. | 251 | // So we by pass that check here. |
252 | let mut peekable = TokenPeek::new(self.subtree.token_trees[self.pos..].iter()); | 252 | let mut peekable = TokenPeek::new(self.subtree.token_trees[self.pos..].iter()); |
253 | let puncts = self.eat_multi_char_punct(punct, &mut peekable); | 253 | let puncts = self.eat_multi_char_punct(punct, &mut peekable); |
254 | let puncts = puncts.unwrap_or_else(|| smallvec![punct.clone()]); | 254 | let puncts = puncts.unwrap_or_else(|| smallvec![*punct]); |
255 | 255 | ||
256 | Some(crate::Separator::Puncts(puncts)) | 256 | Some(crate::Separator::Puncts(puncts)) |
257 | } | 257 | } |