diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-12-23 17:34:23 +0000 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2023-01-17 07:48:19 +0000 |
| commit | bddbf38af29dcfe5ebe12efebf465233fbb52398 (patch) | |
| tree | 5b8bf6c596797e752b0eb0dd00a8eeb1b9cdbb93 /compiler/rustc_expand/src/parse/tests.rs | |
| parent | fc6cda860345b734f7c5e39b7801e3fa4cbaaba0 (diff) | |
| download | rust-bddbf38af29dcfe5ebe12efebf465233fbb52398.tar.gz rust-bddbf38af29dcfe5ebe12efebf465233fbb52398.zip | |
`rustc_expand`: remove `ref` patterns
Diffstat (limited to 'compiler/rustc_expand/src/parse/tests.rs')
| -rw-r--r-- | compiler/rustc_expand/src/parse/tests.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/compiler/rustc_expand/src/parse/tests.rs b/compiler/rustc_expand/src/parse/tests.rs index e49f112bf20..0726d922c84 100644 --- a/compiler/rustc_expand/src/parse/tests.rs +++ b/compiler/rustc_expand/src/parse/tests.rs @@ -176,9 +176,9 @@ fn get_spans_of_pat_idents(src: &str) -> Vec<Span> { } impl<'a> visit::Visitor<'a> for PatIdentVisitor { fn visit_pat(&mut self, p: &'a ast::Pat) { - match p.kind { - PatKind::Ident(_, ref ident, _) => { - self.spans.push(ident.span.clone()); + match &p.kind { + PatKind::Ident(_, ident, _) => { + self.spans.push(ident.span); } _ => { visit::walk_pat(self, p); @@ -290,10 +290,8 @@ fn ttdelim_span() { ) .unwrap(); - let tts: Vec<_> = match expr.kind { - ast::ExprKind::MacCall(ref mac) => mac.args.tokens.clone().into_trees().collect(), - _ => panic!("not a macro"), - }; + let ast::ExprKind::MacCall(mac) = &expr.kind else { panic!("not a macro") }; + let tts: Vec<_> = mac.args.tokens.clone().into_trees().collect(); let span = tts.iter().rev().next().unwrap().span(); @@ -318,11 +316,8 @@ fn out_of_line_mod() { .unwrap() .unwrap(); - if let ast::ItemKind::Mod(_, ref mod_kind) = item.kind { - assert!(matches!(mod_kind, ast::ModKind::Loaded(items, ..) if items.len() == 2)); - } else { - panic!(); - } + let ast::ItemKind::Mod(_, mod_kind) = &item.kind else { panic!() }; + assert!(matches!(mod_kind, ast::ModKind::Loaded(items, ..) if items.len() == 2)); }); } |
