avoid ref in matches
This commit is contained in:
parent
aad2c5af06
commit
97791a56da
@ -115,7 +115,7 @@ fn list_targets() -> impl Iterator<Item = cargo_metadata::Target> {
|
||||
get_arg_flag_value("--manifest-path").map(|m| Path::new(&m).canonicalize().unwrap());
|
||||
|
||||
let mut cmd = cargo_metadata::MetadataCommand::new();
|
||||
if let Some(ref manifest_path) = manifest_path {
|
||||
if let Some(manifest_path) = manifest_path.as_ref() {
|
||||
cmd.manifest_path(manifest_path);
|
||||
}
|
||||
let mut metadata = if let Ok(metadata) = cmd.exec() {
|
||||
@ -131,7 +131,7 @@ fn list_targets() -> impl Iterator<Item = cargo_metadata::Target> {
|
||||
.iter()
|
||||
.position(|package| {
|
||||
let package_manifest_path = Path::new(&package.manifest_path);
|
||||
if let Some(ref manifest_path) = manifest_path {
|
||||
if let Some(manifest_path) = manifest_path.as_ref() {
|
||||
package_manifest_path == manifest_path
|
||||
} else {
|
||||
let current_dir = current_dir.as_ref().expect("could not read current directory");
|
||||
@ -368,7 +368,7 @@ path = "lib.rs"
|
||||
command.env("XARGO_HOME", &dir);
|
||||
command.env("XARGO_RUST_SRC", &rust_src);
|
||||
// Handle target flag.
|
||||
if let Some(ref target) = target {
|
||||
if let Some(target) = target.as_ref() {
|
||||
command.arg("--target").arg(&target);
|
||||
}
|
||||
// Finally run it!
|
||||
@ -379,9 +379,9 @@ path = "lib.rs"
|
||||
// That should be it! But we need to figure out where xargo built stuff.
|
||||
// Unfortunately, it puts things into a different directory when the
|
||||
// architecture matches the host.
|
||||
let is_host = match target {
|
||||
let is_host = match target.as_ref() {
|
||||
None => true,
|
||||
Some(target) => target == rustc_version::version_meta().unwrap().host,
|
||||
Some(target) => target == &rustc_version::version_meta().unwrap().host,
|
||||
};
|
||||
let sysroot = if is_host { dir.join("HOST") } else { PathBuf::from(dir) };
|
||||
std::env::set_var("MIRI_SYSROOT", &sysroot); // pass the env var to the processes we spawn, which will turn it into "--sysroot" flags
|
||||
@ -583,6 +583,6 @@ fn inside_cargo_rustc() {
|
||||
if !exit.success() {
|
||||
std::process::exit(exit.code().unwrap_or(42));
|
||||
},
|
||||
Err(ref e) => panic!("error running {:?}:\n{:?}", command, e),
|
||||
Err(e) => panic!("error running {:?}:\n{:?}", command, e),
|
||||
}
|
||||
}
|
||||
|
@ -51,8 +51,8 @@ pub fn report_error<'tcx, 'mir>(
|
||||
) -> Option<i64> {
|
||||
use InterpError::*;
|
||||
|
||||
let (title, helps) = match e.kind {
|
||||
MachineStop(ref info) => {
|
||||
let (title, helps) = match &e.kind {
|
||||
MachineStop(info) => {
|
||||
let info = info.downcast_ref::<TerminationInfo>().expect("invalid MachineStop payload");
|
||||
use TerminationInfo::*;
|
||||
let title = match info {
|
||||
|
@ -518,7 +518,7 @@ impl AllocationExtra<Tag> for AllocExtra {
|
||||
ptr: Pointer<Tag>,
|
||||
size: Size,
|
||||
) -> InterpResult<'tcx> {
|
||||
if let Some(ref stacked_borrows) = alloc.extra.stacked_borrows {
|
||||
if let Some(stacked_borrows) = alloc.extra.stacked_borrows.as_ref() {
|
||||
stacked_borrows.memory_read(ptr, size)
|
||||
} else {
|
||||
Ok(())
|
||||
@ -531,7 +531,7 @@ impl AllocationExtra<Tag> for AllocExtra {
|
||||
ptr: Pointer<Tag>,
|
||||
size: Size,
|
||||
) -> InterpResult<'tcx> {
|
||||
if let Some(ref mut stacked_borrows) = alloc.extra.stacked_borrows {
|
||||
if let Some(stacked_borrows) = alloc.extra.stacked_borrows.as_mut() {
|
||||
stacked_borrows.memory_written(ptr, size)
|
||||
} else {
|
||||
Ok(())
|
||||
@ -544,7 +544,7 @@ impl AllocationExtra<Tag> for AllocExtra {
|
||||
ptr: Pointer<Tag>,
|
||||
size: Size,
|
||||
) -> InterpResult<'tcx> {
|
||||
if let Some(ref mut stacked_borrows) = alloc.extra.stacked_borrows {
|
||||
if let Some(stacked_borrows) = alloc.extra.stacked_borrows.as_mut() {
|
||||
stacked_borrows.memory_deallocated(ptr, size)
|
||||
} else {
|
||||
Ok(())
|
||||
|
@ -64,7 +64,7 @@ impl<K: Hash + Eq, V> AllocMap<K, V> for MonoHashMap<K, V> {
|
||||
self.0.borrow().iter().filter_map(move |(k, v)| f(k, &*v)).collect()
|
||||
}
|
||||
|
||||
/// The most interesting method: Providing a shared ref without
|
||||
/// The most interesting method: Providing a shared reference without
|
||||
/// holding the `RefCell` open, and inserting new data if the key
|
||||
/// is not used yet.
|
||||
/// `vacant` is called if the key is not found in the map;
|
||||
|
@ -191,7 +191,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
|
||||
let this = self.eval_context_mut();
|
||||
|
||||
match msg {
|
||||
BoundsCheck { ref index, ref len } => {
|
||||
BoundsCheck { index, len } => {
|
||||
// Forward to `panic_bounds_check` lang item.
|
||||
|
||||
// First arg: index.
|
||||
|
@ -87,7 +87,7 @@ impl<'tcx> TlsData<'tcx> {
|
||||
|
||||
pub fn store_tls(&mut self, key: TlsKey, new_data: Option<Scalar<Tag>>) -> InterpResult<'tcx> {
|
||||
match self.keys.get_mut(&key) {
|
||||
Some(&mut TlsEntry { ref mut data, .. }) => {
|
||||
Some(TlsEntry { data, .. }) => {
|
||||
trace!("TLS key {} stored: {:?}", key, new_data);
|
||||
*data = new_data;
|
||||
Ok(())
|
||||
@ -139,12 +139,12 @@ impl<'tcx> TlsData<'tcx> {
|
||||
Some(key) => Excluded(key),
|
||||
None => Unbounded,
|
||||
};
|
||||
for (&key, &mut TlsEntry { ref mut data, dtor }) in
|
||||
for (&key, TlsEntry { data, dtor }) in
|
||||
thread_local.range_mut((start, Unbounded))
|
||||
{
|
||||
if let Some(data_scalar) = *data {
|
||||
if let Some(dtor) = dtor {
|
||||
let ret = Some((dtor, data_scalar, key));
|
||||
let ret = Some((*dtor, data_scalar, key));
|
||||
*data = None;
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user