From e592263e0dbf071c30d3a67689677d9819b8f139 Mon Sep 17 00:00:00 2001
From: Vincent Lafeychine <vincent.lafeychine@proton.me>
Date: Thu, 2 May 2024 21:28:34 +0200
Subject: [PATCH] clippy: Fix semicolon_if_nothing_returned

---
 rr_frontend/.cargo/config.toml                |  1 -
 rr_frontend/attribute_parse/src/parse.rs      |  2 +-
 rr_frontend/radium/src/code.rs                |  2 +-
 rr_frontend/radium/src/coq.rs                 |  2 +-
 rr_frontend/radium/src/specs.rs               | 14 +++++++++-----
 .../src/environment/borrowck/regions.rs       |  2 +-
 .../collect_closure_defs_visitor.rs           |  2 +-
 rr_frontend/translation/src/traits.rs         | 19 ++++++++-----------
 8 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/rr_frontend/.cargo/config.toml b/rr_frontend/.cargo/config.toml
index ad1bf08c..87aa3052 100644
--- a/rr_frontend/.cargo/config.toml
+++ b/rr_frontend/.cargo/config.toml
@@ -32,7 +32,6 @@ rustflags = [
     "-Aclippy::string_lit_as_bytes",
 
     # clippy::pedantic
-    "-Aclippy::semicolon_if_nothing_returned",
     "-Aclippy::trivially_copy_pass_by_ref",
     "-Aclippy::unnecessary_wraps",
     "-Aclippy::unused_self",
diff --git a/rr_frontend/attribute_parse/src/parse.rs b/rr_frontend/attribute_parse/src/parse.rs
index 6f868f2b..cb9366a9 100644
--- a/rr_frontend/attribute_parse/src/parse.rs
+++ b/rr_frontend/attribute_parse/src/parse.rs
@@ -150,7 +150,7 @@ impl ParseBuffer {
     }
 
     pub fn advance(&self, n: usize) {
-        self.index.set(self.index.get() + n)
+        self.index.set(self.index.get() + n);
     }
 
     pub fn advance_get(&self) -> ParseResult<&TokenTree> {
diff --git a/rr_frontend/radium/src/code.rs b/rr_frontend/radium/src/code.rs
index e2d20b50..1bb4a2eb 100644
--- a/rr_frontend/radium/src/code.rs
+++ b/rr_frontend/radium/src/code.rs
@@ -1348,7 +1348,7 @@ impl<'def> FunctionBuilder<'def> {
 
     /// Add a manual tactic used for a sidecondition proof.
     pub fn add_manual_tactic(&mut self, tac: &str) {
-        self.tactics.push(tac.to_string())
+        self.tactics.push(tac.to_string());
     }
 
     /// Add a generic type used by this function.
diff --git a/rr_frontend/radium/src/coq.rs b/rr_frontend/radium/src/coq.rs
index 31cb615c..df073166 100644
--- a/rr_frontend/radium/src/coq.rs
+++ b/rr_frontend/radium/src/coq.rs
@@ -473,7 +473,7 @@ impl CoqTopLevelAssertions {
     }
 
     pub fn push(&mut self, a: CoqTopLevelAssertion) {
-        self.0.push(a)
+        self.0.push(a);
     }
 }
 
diff --git a/rr_frontend/radium/src/specs.rs b/rr_frontend/radium/src/specs.rs
index 966144fc..ba6c80bb 100644
--- a/rr_frontend/radium/src/specs.rs
+++ b/rr_frontend/radium/src/specs.rs
@@ -653,7 +653,7 @@ impl<'def> Type<'def> {
 
             Self::MutRef(box ty, lft) | Self::ShrRef(box ty, lft) => {
                 s.insert(lft.to_string());
-                ty.get_ty_lfts(s)
+                ty.get_ty_lfts(s);
             },
 
             Self::BoxType(box ty) => ty.get_ty_lfts(s),
@@ -684,7 +684,7 @@ impl<'def> Type<'def> {
             | Self::RawPtr => (),
 
             Self::MutRef(box ty, _) | Self::ShrRef(box ty, _) | Self::BoxType(box ty) => {
-                ty.get_ty_wf_elctx(s)
+                ty.get_ty_wf_elctx(s);
             },
 
             Self::Literal(lit) => lit.get_ty_wf_elctx(s),
@@ -718,16 +718,19 @@ impl<'def> Type<'def> {
     {
         match self {
             Self::MutRef(box t, _) | Self::ShrRef(box t, _) | Self::BoxType(box t) => {
-                t.subst_core(substi, to_type)
+                t.subst_core(substi, to_type);
             },
+
             Self::Struct(s) => {
                 // the struct def itself should be closed, but the arguments to it may contain
                 // further variables
                 s.ty_params.iter_mut().map(|a| a.subst_core(substi, to_type)).count();
             },
+
             Self::Enum(s) => {
                 s.ty_params.iter_mut().map(|a| a.subst_core(substi, to_type)).count();
             },
+
             Self::Var(i) => {
                 if let Some(Some(ta)) = substi.get(*i) {
                     let ta_ty: Type<'def> = to_type(ta);
@@ -735,6 +738,7 @@ impl<'def> Type<'def> {
                     *self = ta_ty;
                 }
             },
+
             _ => (),
         }
     }
@@ -744,12 +748,12 @@ impl<'def> Type<'def> {
     /// The types in `substi` should not contain variables themselves, as this substitution
     /// operation is capture-incurring!
     pub fn subst(&mut self, substi: &[Option<Type<'def>>]) {
-        self.subst_core(substi, &Clone::clone)
+        self.subst_core(substi, &Clone::clone);
     }
 
     /// Substitute variables `Var` with `substi`. See `subst` for documentation.
     pub fn subst_params(&mut self, substi: &[Option<LiteralTyParam>]) {
-        self.subst_core(substi, &|x| Type::LiteralParam(x.clone()))
+        self.subst_core(substi, &|x| Type::LiteralParam(x.clone()));
     }
 }
 
diff --git a/rr_frontend/translation/src/environment/borrowck/regions.rs b/rr_frontend/translation/src/environment/borrowck/regions.rs
index a6ddc213..b7a7de68 100644
--- a/rr_frontend/translation/src/environment/borrowck/regions.rs
+++ b/rr_frontend/translation/src/environment/borrowck/regions.rs
@@ -109,7 +109,7 @@ fn extract_region(place_regions: &mut PlaceRegions, local: mir::Local, ty: ty::T
             for (i, ty) in types.iter().enumerate() {
                 match ty.kind() {
                     ty::TyKind::Ref(region, _, _) => {
-                        place_regions.add(local, vec![i], extract_region_id(region))
+                        place_regions.add(local, vec![i], extract_region_id(region));
                     },
                     _ => {
                         // TODO descend into nested types (nested tuples/structs) ?
diff --git a/rr_frontend/translation/src/environment/collect_closure_defs_visitor.rs b/rr_frontend/translation/src/environment/collect_closure_defs_visitor.rs
index a6e092b0..295c4ed1 100644
--- a/rr_frontend/translation/src/environment/collect_closure_defs_visitor.rs
+++ b/rr_frontend/translation/src/environment/collect_closure_defs_visitor.rs
@@ -48,6 +48,6 @@ impl<'env, 'tcx> Visitor<'tcx> for CollectClosureDefsVisitor<'env, 'tcx> {
             self.result.push(*local_def_id);
         }
 
-        walk_expr(self, expr)
+        walk_expr(self, expr);
     }
 }
diff --git a/rr_frontend/translation/src/traits.rs b/rr_frontend/translation/src/traits.rs
index 33039e07..a0fe5d11 100644
--- a/rr_frontend/translation/src/traits.rs
+++ b/rr_frontend/translation/src/traits.rs
@@ -42,24 +42,21 @@ pub fn resolve_impl_source<'tcx>(
     let substs = tcx.normalize_erasing_regions(param_env, substs);
 
     // Check if the `did` is an associated item
-    let trait_ref;
-    if let Some(item) = tcx.opt_associated_item(did) {
+    let trait_ref = if let Some(item) = tcx.opt_associated_item(did) {
         match item.container {
-            AssocItemContainer::TraitContainer =>
-            // this is part of a trait declaration
-            {
-                trait_ref = TraitRef::new(tcx, item.container_id(tcx), substs)
+            AssocItemContainer::TraitContainer => {
+                // this is part of a trait declaration
+                TraitRef::new(tcx, item.container_id(tcx), substs)
             },
-            AssocItemContainer::ImplContainer =>
-            // this is part of an implementation of a trait
-            {
-                trait_ref = tcx.impl_trait_ref(item.container_id(tcx))?.instantiate(tcx, substs)
+            AssocItemContainer::ImplContainer => {
+                // this is part of an implementation of a trait
+                tcx.impl_trait_ref(item.container_id(tcx))?.instantiate(tcx, substs)
             },
         }
     } else {
         // Otherwise, check if it's a reference to a trait itself
         if tcx.is_trait(did) {
-            trait_ref = TraitRef::new(tcx, did, substs)
+            TraitRef::new(tcx, did, substs)
         } else {
             return None;
         }
-- 
GitLab