changeset 49634:ec399ddf6764

rust: use `matches!` macro now that we're using Rust 1.42+
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 14 Nov 2022 15:34:51 +0100
parents 048f829a445a
children 4d729a98673d
files rust/hg-core/src/utils.rs
diffstat 1 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/utils.rs	Mon Nov 14 15:31:49 2022 +0100
+++ b/rust/hg-core/src/utils.rs	Mon Nov 14 15:34:51 2022 +0100
@@ -198,17 +198,18 @@
 
 #[cfg(unix)]
 pub fn shell_quote(value: &[u8]) -> Vec<u8> {
-    // TODO: Use the `matches!` macro when we require Rust 1.42+
-    if value.iter().all(|&byte| match byte {
-        b'a'..=b'z'
-        | b'A'..=b'Z'
-        | b'0'..=b'9'
-        | b'.'
-        | b'_'
-        | b'/'
-        | b'+'
-        | b'-' => true,
-        _ => false,
+    if value.iter().all(|&byte| {
+        matches!(
+            byte,
+            b'a'..=b'z'
+            | b'A'..=b'Z'
+            | b'0'..=b'9'
+            | b'.'
+            | b'_'
+            | b'/'
+            | b'+'
+            | b'-'
+        )
     }) {
         value.to_owned()
     } else {