Skip to content

Commit bf78aec

Browse files
committed
fix clippy::needless_return
1 parent 294fdb8 commit bf78aec

File tree

9 files changed

+13
-13
lines changed

9 files changed

+13
-13
lines changed

src/tools/miri/src/concurrency/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
748748
}
749749
),
750750
);
751-
return Ok(());
751+
Ok(())
752752
}
753753

754754
/// Wake up some thread (if there is any) sleeping on the conditional

src/tools/miri/src/concurrency/thread.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
849849
// https://github.com/rust-lang/miri/issues/1763). In this case,
850850
// just do nothing, which effectively just returns to the
851851
// scheduler.
852-
return Ok(());
852+
Ok(())
853853
}
854854

855855
#[inline]

src/tools/miri/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
clippy::too_many_arguments,
3434
clippy::type_complexity,
3535
clippy::single_element_loop,
36-
clippy::needless_return,
3736
clippy::bool_to_int_with_if,
3837
clippy::box_default,
3938
clippy::needless_question_mark,

src/tools/miri/src/shims/alloc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
7171
// and not execute any Miri shim. Somewhat unintuitively doing so is done
7272
// by returning `NotSupported`, which triggers the `lookup_exported_symbol`
7373
// fallback case in `emulate_foreign_item`.
74-
return Ok(EmulateItemResult::NotSupported);
74+
Ok(EmulateItemResult::NotSupported)
7575
}
7676
AllocatorKind::Default => {
7777
default(this)?;

src/tools/miri/src/shims/env.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
103103
fn get_env_var(&mut self, name: &OsStr) -> InterpResult<'tcx, Option<OsString>> {
104104
let this = self.eval_context_ref();
105105
match &this.machine.env_vars {
106-
EnvVars::Uninit => return Ok(None),
106+
EnvVars::Uninit => Ok(None),
107107
EnvVars::Unix(vars) => vars.get(this, name),
108108
EnvVars::Windows(vars) => vars.get(name),
109109
}

src/tools/miri/src/shims/unix/fd.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -676,12 +676,12 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
676676
this.write_bytes_ptr(buf, bytes[..read_bytes].iter().copied())?;
677677
// The actual read size is always less than what got originally requested so this cannot fail.
678678
this.write_int(u64::try_from(read_bytes).unwrap(), dest)?;
679-
return Ok(());
679+
Ok(())
680680
}
681681
Err(e) => {
682682
this.set_last_error_from_io_error(e)?;
683683
this.write_int(-1, dest)?;
684-
return Ok(());
684+
Ok(())
685685
}
686686
}
687687
}

src/tools/miri/src/shims/unix/linux/epoll.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ fn ready_list_next(
596596
return Some(epoll_event_instance);
597597
}
598598
}
599-
return None;
599+
None
600600
}
601601

602602
/// 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>(
623623
let event_instance = EpollEventInstance::new(flags, epoll_event_interest.data);
624624
// Triggers the notification by inserting it to the ready list.
625625
ready_list.insert(epoll_key, event_instance);
626-
return Ok(true);
626+
Ok(true)
627+
} else {
628+
Ok(false)
627629
}
628-
return Ok(false);
629630
}
630631

631632
/// Callback function after epoll_wait unblocks

src/tools/miri/src/shims/windows/foreign_items.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ pub fn is_dyn_sym(name: &str) -> bool {
2323

2424
#[cfg(windows)]
2525
fn win_absolute<'tcx>(path: &Path) -> InterpResult<'tcx, io::Result<PathBuf>> {
26-
// We are on Windows so we can simply lte the host do this.
27-
return Ok(path::absolute(path));
26+
// We are on Windows so we can simply let the host do this.
27+
Ok(path::absolute(path))
2828
}
2929

3030
#[cfg(unix)]

src/tools/miri/src/shims/windows/sync.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
9090
}
9191
),
9292
);
93-
return Ok(());
93+
Ok(())
9494
}
9595

9696
fn InitOnceComplete(

0 commit comments

Comments
 (0)