about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-09-26 09:36:11 +0200
committerRalf Jung <post@ralfj.de>2024-09-26 11:40:04 +0200
commitbf78aec5106c94fe0d490b91f6b2aaac9c4f6a9c (patch)
treeab29466ea42b66a08dcd90f02bcac826315b1060
parent294fdb820c16ebba2bfa442e53b659752aa48a0d (diff)
downloadrust-bf78aec5106c94fe0d490b91f6b2aaac9c4f6a9c.tar.gz
rust-bf78aec5106c94fe0d490b91f6b2aaac9c4f6a9c.zip
fix clippy::needless_return
-rw-r--r--src/tools/miri/src/concurrency/sync.rs2
-rw-r--r--src/tools/miri/src/concurrency/thread.rs2
-rw-r--r--src/tools/miri/src/lib.rs1
-rw-r--r--src/tools/miri/src/shims/alloc.rs2
-rw-r--r--src/tools/miri/src/shims/env.rs2
-rw-r--r--src/tools/miri/src/shims/unix/fd.rs4
-rw-r--r--src/tools/miri/src/shims/unix/linux/epoll.rs7
-rw-r--r--src/tools/miri/src/shims/windows/foreign_items.rs4
-rw-r--r--src/tools/miri/src/shims/windows/sync.rs2
9 files changed, 13 insertions, 13 deletions
diff --git a/src/tools/miri/src/concurrency/sync.rs b/src/tools/miri/src/concurrency/sync.rs
index bc4d8056872..2b34db047f3 100644
--- a/src/tools/miri/src/concurrency/sync.rs
+++ b/src/tools/miri/src/concurrency/sync.rs
@@ -748,7 +748,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 }
             ),
         );
-        return Ok(());
+        Ok(())
     }
 
     /// Wake up some thread (if there is any) sleeping on the conditional
diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs
index 4efe2beb155..681e9211246 100644
--- a/src/tools/miri/src/concurrency/thread.rs
+++ b/src/tools/miri/src/concurrency/thread.rs
@@ -849,7 +849,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
         // https://github.com/rust-lang/miri/issues/1763). In this case,
         // just do nothing, which effectively just returns to the
         // scheduler.
-        return Ok(());
+        Ok(())
     }
 
     #[inline]
diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs
index 6e015813e77..aa0d29d38f4 100644
--- a/src/tools/miri/src/lib.rs
+++ b/src/tools/miri/src/lib.rs
@@ -33,7 +33,6 @@
     clippy::too_many_arguments,
     clippy::type_complexity,
     clippy::single_element_loop,
-    clippy::needless_return,
     clippy::bool_to_int_with_if,
     clippy::box_default,
     clippy::needless_question_mark,
diff --git a/src/tools/miri/src/shims/alloc.rs b/src/tools/miri/src/shims/alloc.rs
index a33657d33a2..057d7ef5e67 100644
--- a/src/tools/miri/src/shims/alloc.rs
+++ b/src/tools/miri/src/shims/alloc.rs
@@ -71,7 +71,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 // and not execute any Miri shim. Somewhat unintuitively doing so is done
                 // by returning `NotSupported`, which triggers the `lookup_exported_symbol`
                 // fallback case in `emulate_foreign_item`.
-                return Ok(EmulateItemResult::NotSupported);
+                Ok(EmulateItemResult::NotSupported)
             }
             AllocatorKind::Default => {
                 default(this)?;
diff --git a/src/tools/miri/src/shims/env.rs b/src/tools/miri/src/shims/env.rs
index d12a0581b41..c465ef3d28b 100644
--- a/src/tools/miri/src/shims/env.rs
+++ b/src/tools/miri/src/shims/env.rs
@@ -103,7 +103,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
     fn get_env_var(&mut self, name: &OsStr) -> InterpResult<'tcx, Option<OsString>> {
         let this = self.eval_context_ref();
         match &this.machine.env_vars {
-            EnvVars::Uninit => return Ok(None),
+            EnvVars::Uninit => Ok(None),
             EnvVars::Unix(vars) => vars.get(this, name),
             EnvVars::Windows(vars) => vars.get(name),
         }
diff --git a/src/tools/miri/src/shims/unix/fd.rs b/src/tools/miri/src/shims/unix/fd.rs
index 6b78ce7ad47..5fae746af2b 100644
--- a/src/tools/miri/src/shims/unix/fd.rs
+++ b/src/tools/miri/src/shims/unix/fd.rs
@@ -676,12 +676,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 this.write_bytes_ptr(buf, bytes[..read_bytes].iter().copied())?;
                 // The actual read size is always less than what got originally requested so this cannot fail.
                 this.write_int(u64::try_from(read_bytes).unwrap(), dest)?;
-                return Ok(());
+                Ok(())
             }
             Err(e) => {
                 this.set_last_error_from_io_error(e)?;
                 this.write_int(-1, dest)?;
-                return Ok(());
+                Ok(())
             }
         }
     }
diff --git a/src/tools/miri/src/shims/unix/linux/epoll.rs b/src/tools/miri/src/shims/unix/linux/epoll.rs
index b63c29594b4..675a404ae11 100644
--- a/src/tools/miri/src/shims/unix/linux/epoll.rs
+++ b/src/tools/miri/src/shims/unix/linux/epoll.rs
@@ -596,7 +596,7 @@ fn ready_list_next(
             return Some(epoll_event_instance);
         }
     }
-    return None;
+    None
 }
 
 /// This helper function checks whether an epoll notification should be triggered for a specific
@@ -623,9 +623,10 @@ fn check_and_update_one_event_interest<'tcx>(
         let event_instance = EpollEventInstance::new(flags, epoll_event_interest.data);
         // Triggers the notification by inserting it to the ready list.
         ready_list.insert(epoll_key, event_instance);
-        return Ok(true);
+        Ok(true)
+    } else {
+        Ok(false)
     }
-    return Ok(false);
 }
 
 /// Callback function after epoll_wait unblocks
diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs
index 998daddf520..cd8f3e59015 100644
--- a/src/tools/miri/src/shims/windows/foreign_items.rs
+++ b/src/tools/miri/src/shims/windows/foreign_items.rs
@@ -23,8 +23,8 @@ pub fn is_dyn_sym(name: &str) -> bool {
 
 #[cfg(windows)]
 fn win_absolute<'tcx>(path: &Path) -> InterpResult<'tcx, io::Result<PathBuf>> {
-    // We are on Windows so we can simply lte the host do this.
-    return Ok(path::absolute(path));
+    // We are on Windows so we can simply let the host do this.
+    Ok(path::absolute(path))
 }
 
 #[cfg(unix)]
diff --git a/src/tools/miri/src/shims/windows/sync.rs b/src/tools/miri/src/shims/windows/sync.rs
index 51b0129356b..5786b17e50c 100644
--- a/src/tools/miri/src/shims/windows/sync.rs
+++ b/src/tools/miri/src/shims/windows/sync.rs
@@ -90,7 +90,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
                 }
             ),
         );
-        return Ok(());
+        Ok(())
     }
 
     fn InitOnceComplete(