From 36646b4ec21fa3f8e5936edd50be85687373824a Mon Sep 17 00:00:00 2001
From: Vincent Lafeychine <vincent.lafeychine@proton.me>
Date: Sat, 27 Apr 2024 02:42:30 +0200
Subject: [PATCH] clippy: Fix unused_unit

---
 rr_frontend/.cargo/config.toml                |  1 -
 rr_frontend/translation/src/function_body.rs  | 54 +++++++------------
 rr_frontend/translation/src/lib.rs            |  2 +-
 .../src/spec_parsers/enum_spec_parser.rs      |  1 -
 .../src/spec_parsers/struct_spec_parser.rs    |  1 -
 5 files changed, 19 insertions(+), 40 deletions(-)

diff --git a/rr_frontend/.cargo/config.toml b/rr_frontend/.cargo/config.toml
index c344cf30..c4f408c2 100644
--- a/rr_frontend/.cargo/config.toml
+++ b/rr_frontend/.cargo/config.toml
@@ -81,7 +81,6 @@ rustflags = [
 
     # clippy::style
     "-Aclippy::new_without_default",
-    "-Aclippy::unused_unit",
     "-Aclippy::unwrap_or_default",
     "-Aclippy::write_with_newline",
 
diff --git a/rr_frontend/translation/src/function_body.rs b/rr_frontend/translation/src/function_body.rs
index 871e676e..0a66f32e 100644
--- a/rr_frontend/translation/src/function_body.rs
+++ b/rr_frontend/translation/src/function_body.rs
@@ -2799,14 +2799,12 @@ impl<'a, 'def: 'a, 'tcx: 'def> BodyTranslator<'a, 'def, 'tcx> {
                 StatementKind::FakeRead(b) => {
                     // we can probably ignore this, but I'm not sure
                     info!("Ignoring FakeRead: {:?}", b);
-                    ()
                 },
                 StatementKind::SetDiscriminant {
                     place: _place,
                     variant_index: _variant_index,
-                } =>
-                // TODO
-                {
+                } => {
+                    // TODO
                     return Err(TranslationError::UnsupportedFeature {
                         description: "TODO: implement SetDiscriminant".to_string(),
                     });
@@ -2814,54 +2812,38 @@ impl<'a, 'def: 'a, 'tcx: 'def> BodyTranslator<'a, 'def, 'tcx> {
                 StatementKind::PlaceMention(place) => {
                     // TODO: this is missed UB
                     info!("Ignoring PlaceMention: {:?}", place);
-                    ()
                 },
                 StatementKind::Intrinsic(_intrinsic) => {
                     return Err(TranslationError::UnsupportedFeature {
                         description: "TODO: implement Intrinsic".to_string(),
                     });
                 },
-                StatementKind::ConstEvalCounter =>
-                // no-op
-                {
-                    ()
+                StatementKind::ConstEvalCounter => {
+                    // no-op
                 },
-                StatementKind::StorageLive(_) =>
-                // just ignore
-                {
-                    ()
+                StatementKind::StorageLive(_) => {
+                    // just ignore
                 },
-                StatementKind::StorageDead(_) =>
-                // just ignore
-                {
-                    ()
+                StatementKind::StorageDead(_) => {
+                    // just ignore
                 },
-                StatementKind::Deinit(_) =>
-                // TODO: find out where this is emitted
-                {
+                StatementKind::Deinit(_) => {
+                    // TODO: find out where this is emitted
                     return Err(TranslationError::UnsupportedFeature {
                         description: "Unsupported statement: Deinit".to_string(),
                     });
                 },
-                StatementKind::Retag(_, _) =>
-                // just ignore retags
-                {
-                    ()
+                StatementKind::Retag(_, _) => {
+                    // just ignore retags
                 },
-                StatementKind::AscribeUserType(_, _) =>
-                // don't need that info
-                {
-                    ()
+                StatementKind::AscribeUserType(_, _) => {
+                    // don't need that info
                 },
-                StatementKind::Coverage(_) =>
-                // don't need that
-                {
-                    ()
+                StatementKind::Coverage(_) => {
+                    // don't need that
                 },
-                StatementKind::Nop =>
-                // ignore
-                {
-                    ()
+                StatementKind::Nop => {
+                    // ignore
                 },
             }
             cont_stmt = self.prepend_endlfts(cont_stmt, dying_loans.into_iter());
diff --git a/rr_frontend/translation/src/lib.rs b/rr_frontend/translation/src/lib.rs
index 87908ad2..0da306a3 100644
--- a/rr_frontend/translation/src/lib.rs
+++ b/rr_frontend/translation/src/lib.rs
@@ -1234,7 +1234,7 @@ fn scan_loadpaths(paths: &[std::path::PathBuf]) -> io::Result<HashMap<String, st
 /// Translate a crate, creating a `VerificationCtxt` in the process.
 pub fn generate_coq_code<'tcx, F>(tcx: TyCtxt<'tcx>, continuation: F) -> Result<(), String>
 where
-    F: Fn(VerificationCtxt<'tcx, '_>) -> (),
+    F: Fn(VerificationCtxt<'tcx, '_>),
 {
     let env = Environment::new(tcx);
     let env: &Environment = &*Box::leak(Box::new(env));
diff --git a/rr_frontend/translation/src/spec_parsers/enum_spec_parser.rs b/rr_frontend/translation/src/spec_parsers/enum_spec_parser.rs
index 0e4cae27..fd1b26e7 100644
--- a/rr_frontend/translation/src/spec_parsers/enum_spec_parser.rs
+++ b/rr_frontend/translation/src/spec_parsers/enum_spec_parser.rs
@@ -130,7 +130,6 @@ impl EnumSpecParser for VerboseEnumSpecParser {
                         },
                         _ => {
                             // skip and ignore other attributes
-                            ()
                         },
                     }
                 }
diff --git a/rr_frontend/translation/src/spec_parsers/struct_spec_parser.rs b/rr_frontend/translation/src/spec_parsers/struct_spec_parser.rs
index e353859c..3fb50016 100644
--- a/rr_frontend/translation/src/spec_parsers/struct_spec_parser.rs
+++ b/rr_frontend/translation/src/spec_parsers/struct_spec_parser.rs
@@ -271,7 +271,6 @@ impl InvariantSpecParser for VerboseInvariantSpecParser {
                     },
                     _ => {
                         //skip, this may be part of an enum spec
-                        ()
                     },
                 }
             }
-- 
GitLab