From 51b1529ad025bd63ee7ab316d81ba245872532de Mon Sep 17 00:00:00 2001
From: Vincent Lafeychine <vincent.lafeychine@proton.me>
Date: Sun, 14 Apr 2024 18:56:08 +0200
Subject: [PATCH] clippy: Fix match_single_binding

---
 rr_frontend/.cargo/config.toml                |  1 -
 .../src/bin/refinedrust-rustc.rs              | 28 ++++++++-----------
 rr_frontend/translation/src/function_body.rs  |  8 ++----
 .../verbose_function_spec_parser.rs           |  6 +---
 4 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/rr_frontend/.cargo/config.toml b/rr_frontend/.cargo/config.toml
index 122241c5..e8f46753 100644
--- a/rr_frontend/.cargo/config.toml
+++ b/rr_frontend/.cargo/config.toml
@@ -21,7 +21,6 @@ rustflags = [
     "-Aunused_variables",
 
     # clippy::complexity
-    "-Aclippy::match_single_binding",
     "-Aclippy::needless_borrowed_reference",
     "-Aclippy::needless_lifetimes",
     "-Aclippy::only_used_in_recursion",
diff --git a/rr_frontend/refinedrust_frontend/src/bin/refinedrust-rustc.rs b/rr_frontend/refinedrust_frontend/src/bin/refinedrust-rustc.rs
index fa2fb076..8ea368fc 100644
--- a/rr_frontend/refinedrust_frontend/src/bin/refinedrust-rustc.rs
+++ b/rr_frontend/refinedrust_frontend/src/bin/refinedrust-rustc.rs
@@ -180,22 +180,18 @@ fn main() {
             // Very first arg: binary name.
             rustc_args.push(arg);
         } else {
-            match arg.as_str() {
-                _ => {
-                    // Disable incremental compilation because it causes mir_borrowck not to be called.
-                    if arg == "--codegen" || arg == "-C" {
-                        is_codegen = true;
-                    } else if is_codegen && arg.starts_with("incremental=") {
-                        // Just drop the argument.
-                        is_codegen = false;
-                    } else {
-                        if is_codegen {
-                            rustc_args.push("-C".to_owned());
-                            is_codegen = false;
-                        }
-                        rustc_args.push(arg);
-                    }
-                },
+            // Disable incremental compilation because it causes mir_borrowck not to be called.
+            if arg == "--codegen" || arg == "-C" {
+                is_codegen = true;
+            } else if is_codegen && arg.starts_with("incremental=") {
+                // Just drop the argument.
+                is_codegen = false;
+            } else {
+                if is_codegen {
+                    rustc_args.push("-C".to_owned());
+                    is_codegen = false;
+                }
+                rustc_args.push(arg);
             }
         }
     }
diff --git a/rr_frontend/translation/src/function_body.rs b/rr_frontend/translation/src/function_body.rs
index ebd311e3..69c165e5 100644
--- a/rr_frontend/translation/src/function_body.rs
+++ b/rr_frontend/translation/src/function_body.rs
@@ -3123,12 +3123,10 @@ impl<'a, 'def: 'a, 'tcx: 'def> BodyTranslator<'a, 'def, 'tcx> {
                 })
             },
             Rvalue::NullaryOp(op, _ty) => {
-                match op {
-                    _ => Err(TranslationError::UnsupportedFeature {
-                        description: "nullary ops (AlignOf, Sizeof) are not supported currently".to_string(),
-                    }),
-                }
                 // TODO: SizeOf
+                Err(TranslationError::UnsupportedFeature {
+                    description: "nullary ops (AlignOf, Sizeof) are not supported currently".to_string(),
+                })
             },
             Rvalue::Discriminant(pl) => {
                 let ty = self.get_type_of_place(pl)?;
diff --git a/rr_frontend/translation/src/spec_parsers/verbose_function_spec_parser.rs b/rr_frontend/translation/src/spec_parsers/verbose_function_spec_parser.rs
index 95a6e46a..7b0e08dc 100644
--- a/rr_frontend/translation/src/spec_parsers/verbose_function_spec_parser.rs
+++ b/rr_frontend/translation/src/spec_parsers/verbose_function_spec_parser.rs
@@ -692,11 +692,7 @@ where
                             let meta: &[specs::LiteralTyParam] = builder.get_ty_params();
                             let _meta: ParseMeta = (&meta, &lfts);
 
-                            match seg.ident.name.as_str() {
-                                _ => {
-                                    info!("ignoring function attribute: {:?}", args);
-                                },
-                            }
+                            info!("ignoring function attribute: {:?}", args);
                         }
                     },
                     Err(e) => {
-- 
GitLab