mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-30 13:06:28 +03:00
some clippy-induced cleanup
This commit is contained in:
@@ -259,10 +259,7 @@ fn new(alloc: VTimestamp, alloc_index: VectorIdx) -> Self {
|
||||
/// Load the internal atomic memory cells if they exist.
|
||||
#[inline]
|
||||
fn atomic(&self) -> Option<&AtomicMemoryCellClocks> {
|
||||
match &self.atomic_ops {
|
||||
Some(op) => Some(&*op),
|
||||
None => None,
|
||||
}
|
||||
self.atomic_ops.as_deref()
|
||||
}
|
||||
|
||||
/// Load or create the internal atomic memory metadata
|
||||
@@ -1482,7 +1479,7 @@ fn print_thread_metadata(&self, vector: VectorIdx) -> String {
|
||||
let thread_name = &self.thread_info.borrow()[thread].thread_name;
|
||||
if let Some(name) = thread_name {
|
||||
let name: &str = name;
|
||||
format!("Thread(id = {:?}, name = {:?})", thread.to_u32(), &*name)
|
||||
format!("Thread(id = {:?}, name = {:?})", thread.to_u32(), name)
|
||||
} else {
|
||||
format!("Thread(id = {:?})", thread.to_u32())
|
||||
}
|
||||
|
||||
+1
-1
@@ -255,7 +255,7 @@ fn call_function(
|
||||
}
|
||||
|
||||
// Push frame.
|
||||
let mir = &*this.load_mir(f.def, None)?;
|
||||
let mir = this.load_mir(f.def, None)?;
|
||||
this.push_stack_frame(f, mir, dest, stack_pop)?;
|
||||
|
||||
// Initialize arguments.
|
||||
|
||||
@@ -61,7 +61,7 @@ fn remove<Q: ?Sized + Hash + Eq>(&mut self, k: &Q) -> Option<V>
|
||||
|
||||
#[inline(always)]
|
||||
fn filter_map_collect<T>(&self, mut f: impl FnMut(&K, &V) -> Option<T>) -> Vec<T> {
|
||||
self.0.borrow().iter().filter_map(move |(k, v)| f(k, &*v)).collect()
|
||||
self.0.borrow().iter().filter_map(move |(k, v)| f(k, v)).collect()
|
||||
}
|
||||
|
||||
/// The most interesting method: Providing a shared reference without
|
||||
|
||||
@@ -243,7 +243,7 @@ fn emulate_foreign_item(
|
||||
// First: functions that diverge.
|
||||
let ret = match ret {
|
||||
None =>
|
||||
match &*link_name.as_str() {
|
||||
match link_name.as_str() {
|
||||
"miri_start_panic" => {
|
||||
// `check_shim` happens inside `handle_miri_start_panic`.
|
||||
this.handle_miri_start_panic(abi, link_name, args, unwind)?;
|
||||
@@ -259,7 +259,7 @@ fn emulate_foreign_item(
|
||||
let panic_impl_id = tcx.lang_items().panic_impl().unwrap();
|
||||
let panic_impl_instance = ty::Instance::mono(tcx, panic_impl_id);
|
||||
return Ok(Some((
|
||||
&*this.load_mir(panic_impl_instance.def, None)?,
|
||||
this.load_mir(panic_impl_instance.def, None)?,
|
||||
panic_impl_instance,
|
||||
)));
|
||||
}
|
||||
@@ -361,7 +361,7 @@ fn emulate_foreign_item_by_name(
|
||||
|
||||
// Here we dispatch all the shims for foreign functions. If you have a platform specific
|
||||
// shim, add it to the corresponding submodule.
|
||||
match &*link_name.as_str() {
|
||||
match link_name.as_str() {
|
||||
// Miri-specific extern functions
|
||||
"miri_static_root" => {
|
||||
let [ptr] = this.check_shim(abi, Abi::Rust, link_name, args)?;
|
||||
@@ -573,7 +573,7 @@ fn emulate_foreign_item_by_name(
|
||||
let [f] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
// FIXME: Using host floats.
|
||||
let f = f32::from_bits(this.read_scalar(f)?.to_u32()?);
|
||||
let f = match &*link_name.as_str() {
|
||||
let f = match link_name.as_str() {
|
||||
"cbrtf" => f.cbrt(),
|
||||
"coshf" => f.cosh(),
|
||||
"sinhf" => f.sinh(),
|
||||
@@ -596,7 +596,7 @@ fn emulate_foreign_item_by_name(
|
||||
// FIXME: Using host floats.
|
||||
let f1 = f32::from_bits(this.read_scalar(f1)?.to_u32()?);
|
||||
let f2 = f32::from_bits(this.read_scalar(f2)?.to_u32()?);
|
||||
let n = match &*link_name.as_str() {
|
||||
let n = match link_name.as_str() {
|
||||
"_hypotf" | "hypotf" => f1.hypot(f2),
|
||||
"atan2f" => f1.atan2(f2),
|
||||
_ => bug!(),
|
||||
@@ -615,7 +615,7 @@ fn emulate_foreign_item_by_name(
|
||||
let [f] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
// FIXME: Using host floats.
|
||||
let f = f64::from_bits(this.read_scalar(f)?.to_u64()?);
|
||||
let f = match &*link_name.as_str() {
|
||||
let f = match link_name.as_str() {
|
||||
"cbrt" => f.cbrt(),
|
||||
"cosh" => f.cosh(),
|
||||
"sinh" => f.sinh(),
|
||||
@@ -636,7 +636,7 @@ fn emulate_foreign_item_by_name(
|
||||
// FIXME: Using host floats.
|
||||
let f1 = f64::from_bits(this.read_scalar(f1)?.to_u64()?);
|
||||
let f2 = f64::from_bits(this.read_scalar(f2)?.to_u64()?);
|
||||
let n = match &*link_name.as_str() {
|
||||
let n = match link_name.as_str() {
|
||||
"_hypot" | "hypot" => f1.hypot(f2),
|
||||
"atan2" => f1.atan2(f2),
|
||||
_ => bug!(),
|
||||
|
||||
+1
-1
@@ -55,7 +55,7 @@ fn find_mir_or_eval_fn(
|
||||
}
|
||||
|
||||
// Otherwise, load the MIR.
|
||||
Ok(Some((&*this.load_mir(instance.def, None)?, instance)))
|
||||
Ok(Some((this.load_mir(instance.def, None)?, instance)))
|
||||
}
|
||||
|
||||
/// Returns `true` if the computation was performed, and `false` if we should just evaluate
|
||||
|
||||
@@ -26,7 +26,7 @@ fn emulate_foreign_item_by_name(
|
||||
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
match &*link_name.as_str() {
|
||||
match link_name.as_str() {
|
||||
// Environment related shims
|
||||
"getenv" => {
|
||||
let [name] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
|
||||
@@ -446,7 +446,7 @@ fn file_type_to_d_type(
|
||||
}
|
||||
}
|
||||
Err(e) =>
|
||||
return match e.raw_os_error() {
|
||||
match e.raw_os_error() {
|
||||
Some(error) => Ok(error),
|
||||
None =>
|
||||
throw_unsup_format!(
|
||||
|
||||
@@ -9,7 +9,7 @@ impl Dlsym {
|
||||
// Returns an error for unsupported symbols, and None if this symbol
|
||||
// should become a NULL pointer (pretend it does not exist).
|
||||
pub fn from_str<'tcx>(name: &str) -> InterpResult<'tcx, Option<Dlsym>> {
|
||||
Ok(match &*name {
|
||||
Ok(match name {
|
||||
"__pthread_get_minstack" => None,
|
||||
"getrandom" => None, // std falls back to syscall(SYS_getrandom, ...) when this is NULL.
|
||||
"statx" => None, // std falls back to syscall(SYS_statx, ...) when this is NULL.
|
||||
|
||||
@@ -21,7 +21,7 @@ fn emulate_foreign_item_by_name(
|
||||
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
match &*link_name.as_str() {
|
||||
match link_name.as_str() {
|
||||
// errno
|
||||
"__errno_location" => {
|
||||
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
|
||||
@@ -19,7 +19,7 @@ fn emulate_foreign_item_by_name(
|
||||
) -> InterpResult<'tcx, EmulateByNameResult<'mir, 'tcx>> {
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
match &*link_name.as_str() {
|
||||
match link_name.as_str() {
|
||||
// errno
|
||||
"__error" => {
|
||||
let [] = this.check_shim(abi, Abi::C { unwind: false }, link_name, args)?;
|
||||
|
||||
@@ -28,7 +28,7 @@ fn emulate_foreign_item_by_name(
|
||||
// DWORD = ULONG = u32
|
||||
// BOOL = i32
|
||||
// BOOLEAN = u8
|
||||
match &*link_name.as_str() {
|
||||
match link_name.as_str() {
|
||||
// Environment related shims
|
||||
"GetEnvironmentVariableW" => {
|
||||
let [name, buf, size] =
|
||||
|
||||
Reference in New Issue
Block a user