Skip to content

Commit b8d5ee0

Browse files
committed
Auto merge of rust-lang#2216 - RalfJung:rustup, r=RalfJung
rustup Locally I see lots of new clippy failures, but did clippy really add a bunch of new lints recently?
2 parents eedc78d + 295e18d commit b8d5ee0

13 files changed

+24
-22
lines changed

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ install that exact version of rustc as a toolchain:
2828
This will set up a rustup toolchain called `miri` and set it as an override for
2929
the current directory.
3030

31+
If you want to also have `clippy` installed, you need to run this:
32+
```
33+
./rustup-toolchain "" -c clippy
34+
```
35+
3136
[`rustup-toolchain-install-master`]: https://github.com/kennytm/rustup-toolchain-install-master
3237

3338
## Building and testing Miri

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9d20fd109809f20c049d6895a5be27a1fbd39daa
1+
e45d9973b2665897a768312e971b82cc62633103

src/concurrency/data_race.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,7 @@ impl MemoryCellClocks {
259259
/// Load the internal atomic memory cells if they exist.
260260
#[inline]
261261
fn atomic(&self) -> Option<&AtomicMemoryCellClocks> {
262-
match &self.atomic_ops {
263-
Some(op) => Some(&*op),
264-
None => None,
265-
}
262+
self.atomic_ops.as_deref()
266263
}
267264

268265
/// Load or create the internal atomic memory metadata
@@ -1482,7 +1479,7 @@ impl GlobalState {
14821479
let thread_name = &self.thread_info.borrow()[thread].thread_name;
14831480
if let Some(name) = thread_name {
14841481
let name: &str = name;
1485-
format!("Thread(id = {:?}, name = {:?})", thread.to_u32(), &*name)
1482+
format!("Thread(id = {:?}, name = {:?})", thread.to_u32(), name)
14861483
} else {
14871484
format!("Thread(id = {:?})", thread.to_u32())
14881485
}

src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
255255
}
256256

257257
// Push frame.
258-
let mir = &*this.load_mir(f.def, None)?;
258+
let mir = this.load_mir(f.def, None)?;
259259
this.push_stack_frame(f, mir, dest, stack_pop)?;
260260

261261
// Initialize arguments.

src/mono_hash_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl<K: Hash + Eq, V> AllocMap<K, V> for MonoHashMap<K, V> {
6161

6262
#[inline(always)]
6363
fn filter_map_collect<T>(&self, mut f: impl FnMut(&K, &V) -> Option<T>) -> Vec<T> {
64-
self.0.borrow().iter().filter_map(move |(k, v)| f(k, &*v)).collect()
64+
self.0.borrow().iter().filter_map(move |(k, v)| f(k, v)).collect()
6565
}
6666

6767
/// The most interesting method: Providing a shared reference without

src/shims/foreign_items.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
243243
// First: functions that diverge.
244244
let ret = match ret {
245245
None =>
246-
match &*link_name.as_str() {
246+
match link_name.as_str() {
247247
"miri_start_panic" => {
248248
// `check_shim` happens inside `handle_miri_start_panic`.
249249
this.handle_miri_start_panic(abi, link_name, args, unwind)?;
@@ -259,7 +259,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
259259
let panic_impl_id = tcx.lang_items().panic_impl().unwrap();
260260
let panic_impl_instance = ty::Instance::mono(tcx, panic_impl_id);
261261
return Ok(Some((
262-
&*this.load_mir(panic_impl_instance.def, None)?,
262+
this.load_mir(panic_impl_instance.def, None)?,
263263
panic_impl_instance,
264264
)));
265265
}
@@ -361,7 +361,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
361361

362362
// Here we dispatch all the shims for foreign functions. If you have a platform specific
363363
// shim, add it to the corresponding submodule.
364-
match &*link_name.as_str() {
364+
match link_name.as_str() {
365365
// Miri-specific extern functions
366366
"miri_static_root" => {
367367
let [ptr] = this.check_shim(abi, Abi::Rust, link_name, args)?;
@@ -573,7 +573,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
573573
let [f] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
574574
// FIXME: Using host floats.
575575
let f = f32::from_bits(this.read_scalar(f)?.to_u32()?);
576-
let f = match &*link_name.as_str() {
576+
let f = match link_name.as_str() {
577577
"cbrtf" => f.cbrt(),
578578
"coshf" => f.cosh(),
579579
"sinhf" => f.sinh(),
@@ -596,7 +596,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
596596
// FIXME: Using host floats.
597597
let f1 = f32::from_bits(this.read_scalar(f1)?.to_u32()?);
598598
let f2 = f32::from_bits(this.read_scalar(f2)?.to_u32()?);
599-
let n = match &*link_name.as_str() {
599+
let n = match link_name.as_str() {
600600
"_hypotf" | "hypotf" => f1.hypot(f2),
601601
"atan2f" => f1.atan2(f2),
602602
_ => bug!(),
@@ -615,7 +615,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
615615
let [f] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
616616
// FIXME: Using host floats.
617617
let f = f64::from_bits(this.read_scalar(f)?.to_u64()?);
618-
let f = match &*link_name.as_str() {
618+
let f = match link_name.as_str() {
619619
"cbrt" => f.cbrt(),
620620
"cosh" => f.cosh(),
621621
"sinh" => f.sinh(),
@@ -636,7 +636,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
636636
// FIXME: Using host floats.
637637
let f1 = f64::from_bits(this.read_scalar(f1)?.to_u64()?);
638638
let f2 = f64::from_bits(this.read_scalar(f2)?.to_u64()?);
639-
let n = match &*link_name.as_str() {
639+
let n = match link_name.as_str() {
640640
"_hypot" | "hypot" => f1.hypot(f2),
641641
"atan2" => f1.atan2(f2),
642642
_ => bug!(),

src/shims/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5555
}
5656

5757
// Otherwise, load the MIR.
58-
Ok(Some((&*this.load_mir(instance.def, None)?, instance)))
58+
Ok(Some((this.load_mir(instance.def, None)?, instance)))
5959
}
6060

6161
/// Returns `true` if the computation was performed, and `false` if we should just evaluate

src/shims/unix/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2626
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
2727
let this = self.eval_context_mut();
2828

29-
match &*link_name.as_str() {
29+
match link_name.as_str() {
3030
// Environment related shims
3131
"getenv" => {
3232
let [name] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

src/shims/unix/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, '
446446
}
447447
}
448448
Err(e) =>
449-
return match e.raw_os_error() {
449+
match e.raw_os_error() {
450450
Some(error) => Ok(error),
451451
None =>
452452
throw_unsup_format!(

src/shims/unix/linux/dlsym.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl Dlsym {
99
// Returns an error for unsupported symbols, and None if this symbol
1010
// should become a NULL pointer (pretend it does not exist).
1111
pub fn from_str<'tcx>(name: &str) -> InterpResult<'tcx, Option<Dlsym>> {
12-
Ok(match &*name {
12+
Ok(match name {
1313
"__pthread_get_minstack" => None,
1414
"getrandom" => None, // std falls back to syscall(SYS_getrandom, ...) when this is NULL.
1515
"statx" => None, // std falls back to syscall(SYS_statx, ...) when this is NULL.

src/shims/unix/linux/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2121
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
2222
let this = self.eval_context_mut();
2323

24-
match &*link_name.as_str() {
24+
match link_name.as_str() {
2525
// errno
2626
"__errno_location" => {
2727
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

src/shims/unix/macos/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
1919
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
2020
let this = self.eval_context_mut();
2121

22-
match &*link_name.as_str() {
22+
match link_name.as_str() {
2323
// errno
2424
"__error" => {
2525
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;

src/shims/windows/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2828
// DWORD = ULONG = u32
2929
// BOOL = i32
3030
// BOOLEAN = u8
31-
match &*link_name.as_str() {
31+
match link_name.as_str() {
3232
// Environment related shims
3333
"GetEnvironmentVariableW" => {
3434
let [name, buf, size] =

0 commit comments

Comments
 (0)