From 95f6ea920d56d9f3db52f5fa0a81f0ec4dffde5f Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Tue, 17 Nov 2015 23:24:49 +0900 Subject: Fix match_ref_pats flagged by Clippy --- src/libsyntax/ext/deriving/generic/ty.rs | 4 ++-- src/libsyntax/ext/quote.rs | 6 +++--- src/libsyntax/ext/tt/macro_parser.rs | 34 ++++++++++++++++---------------- 3 files changed, 22 insertions(+), 22 deletions(-) (limited to 'src/libsyntax/ext') diff --git a/src/libsyntax/ext/deriving/generic/ty.rs b/src/libsyntax/ext/deriving/generic/ty.rs index 9e8e68c0b8c..67826c9c6cd 100644 --- a/src/libsyntax/ext/deriving/generic/ty.rs +++ b/src/libsyntax/ext/deriving/generic/ty.rs @@ -242,8 +242,8 @@ impl<'a> LifetimeBounds<'a> { cx.lifetime_def(span, cx.ident_of(*lt).name, bounds) }).collect(); let ty_params = self.bounds.iter().map(|t| { - match t { - &(ref name, ref bounds) => { + match *t { + (ref name, ref bounds) => { mk_ty_param(cx, span, *name, diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index d743a601bbb..5e5b8158181 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -63,9 +63,9 @@ pub mod rt { impl ToTokens for Option { fn to_tokens(&self, cx: &ExtCtxt) -> Vec { - match self { - &Some(ref t) => t.to_tokens(cx), - &None => Vec::new(), + match *self { + Some(ref t) => t.to_tokens(cx), + None => Vec::new(), } } } diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index dded634882d..675482fd644 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -107,16 +107,16 @@ enum TokenTreeOrTokenTreeVec { impl TokenTreeOrTokenTreeVec { fn len(&self) -> usize { - match self { - &TtSeq(ref v) => v.len(), - &Tt(ref tt) => tt.len(), + match *self { + TtSeq(ref v) => v.len(), + Tt(ref tt) => tt.len(), } } fn get_tt(&self, index: usize) -> TokenTree { - match self { - &TtSeq(ref v) => v[index].clone(), - &Tt(ref tt) => tt.get_tt(index), + match *self { + TtSeq(ref v) => v[index].clone(), + Tt(ref tt) => tt.get_tt(index), } } } @@ -144,17 +144,17 @@ pub struct MatcherPos { pub fn count_names(ms: &[TokenTree]) -> usize { ms.iter().fold(0, |count, elt| { - count + match elt { - &TokenTree::Sequence(_, ref seq) => { + count + match *elt { + TokenTree::Sequence(_, ref seq) => { seq.num_captures } - &TokenTree::Delimited(_, ref delim) => { + TokenTree::Delimited(_, ref delim) => { count_names(&delim.tts) } - &TokenTree::Token(_, MatchNt(..)) => { + TokenTree::Token(_, MatchNt(..)) => { 1 } - &TokenTree::Token(_, _) => 0, + TokenTree::Token(_, _) => 0, } }) } @@ -203,18 +203,18 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc]) -> HashMap> { fn n_rec(p_s: &ParseSess, m: &TokenTree, res: &[Rc], ret_val: &mut HashMap>, idx: &mut usize) { - match m { - &TokenTree::Sequence(_, ref seq) => { + match *m { + TokenTree::Sequence(_, ref seq) => { for next_m in &seq.tts { n_rec(p_s, next_m, res, ret_val, idx) } } - &TokenTree::Delimited(_, ref delim) => { + TokenTree::Delimited(_, ref delim) => { for next_m in &delim.tts { n_rec(p_s, next_m, res, ret_val, idx) } } - &TokenTree::Token(sp, MatchNt(bind_name, _, _, _)) => { + TokenTree::Token(sp, MatchNt(bind_name, _, _, _)) => { match ret_val.entry(bind_name.name) { Vacant(spot) => { spot.insert(res[*idx].clone()); @@ -228,8 +228,8 @@ pub fn nameize(p_s: &ParseSess, ms: &[TokenTree], res: &[Rc]) } } } - &TokenTree::Token(_, SubstNt(..)) => panic!("Cannot fill in a NT"), - &TokenTree::Token(_, _) => (), + TokenTree::Token(_, SubstNt(..)) => panic!("Cannot fill in a NT"), + TokenTree::Token(_, _) => (), } } let mut ret_val = HashMap::new(); -- cgit 1.4.1-3-g733a5