From 4ad9e986ad05e404df73701c098b71f73a847ca6 Mon Sep 17 00:00:00 2001 From: Jeremy Kolb Date: Thu, 4 Jul 2019 13:26:44 -0400 Subject: Some clippy fixes for 1.36 --- crates/ra_mbe/src/mbe_expander.rs | 2 +- crates/ra_mbe/src/mbe_parser.rs | 2 +- crates/ra_mbe/src/subtree_source.rs | 2 +- crates/ra_mbe/src/syntax_bridge.rs | 2 +- crates/ra_mbe/src/tt_cursor.rs | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/ra_mbe/src') 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( tt::Leaf::from(tt::Ident { text: ident.text.clone(), id: TokenId::unspecified() }) .into() } - crate::Leaf::Punct(punct) => tt::Leaf::from(punct.clone()).into(), + crate::Leaf::Punct(punct) => tt::Leaf::from(*punct).into(), crate::Leaf::Var(v) => { if v.text == "crate" { // 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::Leaf::from(*punct).into(), - tt::Leaf::Ident(tt::Ident { text, id: _ }) => { + tt::Leaf::Ident(tt::Ident { text, .. }) => { crate::Leaf::from(crate::Ident { text: text.clone() }).into() } 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> { } } - return cached[pos].clone(); + cached[pos].clone() } } 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 impl TokenMap { pub fn relative_range_of(&self, tt: tt::TokenId) -> Option { let idx = tt.0 as usize; - self.tokens.get(idx).map(|&it| it) + self.tokens.get(idx).copied() } 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> { } fn eat_punct3(&mut self, p: &tt::Punct) -> Option> { - let sec = self.eat_punct()?.clone(); - let third = self.eat_punct()?.clone(); - Some(smallvec![p.clone(), sec, third]) + let sec = *self.eat_punct()?; + let third = *self.eat_punct()?; + Some(smallvec![*p, sec, third]) } fn eat_punct2(&mut self, p: &tt::Punct) -> Option> { - let sec = self.eat_punct()?.clone(); - Some(smallvec![p.clone(), sec]) + let sec = *self.eat_punct()?; + Some(smallvec![*p, sec]) } fn eat_multi_char_punct<'b, I>( @@ -251,7 +251,7 @@ impl<'a> TtCursor<'a> { // So we by pass that check here. let mut peekable = TokenPeek::new(self.subtree.token_trees[self.pos..].iter()); let puncts = self.eat_multi_char_punct(punct, &mut peekable); - let puncts = puncts.unwrap_or_else(|| smallvec![punct.clone()]); + let puncts = puncts.unwrap_or_else(|| smallvec![*punct]); Some(crate::Separator::Puncts(puncts)) } -- cgit v1.2.3