From c4c518d2d496774ecc7a368e826480d1928ed1ab Mon Sep 17 00:00:00 2001 From: León Orell Valerian Liehr Date: Wed, 7 Aug 2024 12:41:49 +0200 Subject: Use more slice patterns inside the compiler --- compiler/rustc_parse/src/parser/path.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_parse/src/parser/path.rs') diff --git a/compiler/rustc_parse/src/parser/path.rs b/compiler/rustc_parse/src/parser/path.rs index 70d2c98d4f1..6f82d6b9826 100644 --- a/compiler/rustc_parse/src/parser/path.rs +++ b/compiler/rustc_parse/src/parser/path.rs @@ -826,7 +826,8 @@ impl<'a> Parser<'a> { // We can only resolve single-segment paths at the moment, because multi-segment paths // require type-checking: see `visit_generic_arg` in `src/librustc_resolve/late.rs`. ast::ExprKind::Path(None, path) - if path.segments.len() == 1 && path.segments[0].args.is_none() => + if let [segment] = path.segments.as_slice() + && segment.args.is_none() => { true } -- cgit 1.4.1-3-g733a5