diff --git a/benches/fibonacci.rs b/benches/fibonacci.rs index ebb1b5fd0b18..9a68a69e800f 100644 --- a/benches/fibonacci.rs +++ b/benches/fibonacci.rs @@ -7,7 +7,7 @@ use crate::helpers::*; #[bench] fn fib(bencher: &mut Bencher) { - bencher.iter(|| fibonacci_helper::main()) + bencher.iter(fibonacci_helper::main) } #[bench] @@ -17,7 +17,7 @@ fn fib_miri(bencher: &mut Bencher) { #[bench] fn fib_iter(bencher: &mut Bencher) { - bencher.iter(|| fibonacci_helper_iterative::main()) + bencher.iter(fibonacci_helper_iterative::main) } #[bench] diff --git a/benches/smoke.rs b/benches/smoke.rs index 9229e972d7f3..372cd0b22b7a 100644 --- a/benches/smoke.rs +++ b/benches/smoke.rs @@ -7,7 +7,7 @@ use crate::helpers::*; #[bench] fn noop(bencher: &mut Bencher) { - bencher.iter(|| smoke_helper::main()) + bencher.iter(smoke_helper::main) } /* diff --git a/src/diagnostics.rs b/src/diagnostics.rs index 527ff032d670..ace521f1bed0 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -166,32 +166,32 @@ pub fn report_error<'tcx, 'mir>( match history { Some(TagHistory::Tagged {tag, created: (created_range, created_span), invalidated, protected }) => { let msg = format!("{:?} was created by a retag at offsets {}", tag, HexRange(*created_range)); - helps.push((Some(created_span.clone()), msg)); + helps.push((Some(*created_span), msg)); if let Some((invalidated_range, invalidated_span)) = invalidated { let msg = format!("{:?} was later invalidated at offsets {}", tag, HexRange(*invalidated_range)); - helps.push((Some(invalidated_span.clone()), msg)); + helps.push((Some(*invalidated_span), msg)); } if let Some((protecting_tag, protecting_tag_span, protection_span)) = protected { - helps.push((Some(protecting_tag_span.clone()), format!("{:?} was protected due to {:?} which was created here", tag, protecting_tag))); - helps.push((Some(protection_span.clone()), "this protector is live for this call".to_string())); + helps.push((Some(*protecting_tag_span), format!("{:?} was protected due to {:?} which was created here", tag, protecting_tag))); + helps.push((Some(*protection_span), "this protector is live for this call".to_string())); } } Some(TagHistory::Untagged{ recently_created, recently_invalidated, matching_created, protected }) => { if let Some((range, span)) = recently_created { let msg = format!("tag was most recently created at offsets {}", HexRange(*range)); - helps.push((Some(span.clone()), msg)); + helps.push((Some(*span), msg)); } if let Some((range, span)) = recently_invalidated { let msg = format!("tag was later invalidated at offsets {}", HexRange(*range)); - helps.push((Some(span.clone()), msg)); + helps.push((Some(*span), msg)); } if let Some((range, span)) = matching_created { let msg = format!("this tag was also created here at offsets {}", HexRange(*range)); - helps.push((Some(span.clone()), msg)); + helps.push((Some(*span), msg)); } if let Some((protecting_tag, protecting_tag_span, protection_span)) = protected { - helps.push((Some(protecting_tag_span.clone()), format!("{:?} was protected due to a tag which was created here", protecting_tag))); - helps.push((Some(protection_span.clone()), "this protector is live for this call".to_string())); + helps.push((Some(*protecting_tag_span), format!("{:?} was protected due to a tag which was created here", protecting_tag))); + helps.push((Some(*protection_span), "this protector is live for this call".to_string())); } } None => {} diff --git a/src/eval.rs b/src/eval.rs index 39fccb092433..a782dfa3fce1 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -491,6 +491,6 @@ mod tests { let cmd = String::from_utf16_lossy(&args_to_utf16_command_string( [r"C:\Program Files\", "arg1", "arg 2", "arg \" 3"].iter(), )); - assert_eq!(cmd.trim_end_matches("\0"), r#""C:\Program Files\" arg1 "arg 2" "arg \" 3""#); + assert_eq!(cmd.trim_end_matches('\0'), r#""C:\Program Files\" arg1 "arg 2" "arg \" 3""#); } } diff --git a/src/helpers.rs b/src/helpers.rs index 8339ecde121e..cb4c3c293e93 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -817,7 +817,7 @@ pub struct CurrentSpan<'a, 'mir, 'tcx> { impl<'a, 'mir, 'tcx> CurrentSpan<'a, 'mir, 'tcx> { pub fn get(&mut self) -> Span { - *self.span.get_or_insert_with(|| Self::current_span(&self.machine)) + *self.span.get_or_insert_with(|| Self::current_span(self.machine)) } #[inline(never)] @@ -825,7 +825,7 @@ impl<'a, 'mir, 'tcx> CurrentSpan<'a, 'mir, 'tcx> { machine .threads .active_thread_stack() - .into_iter() + .iter() .rev() .find(|frame| { let def_id = frame.instance.def_id(); diff --git a/src/shims/posix/fs.rs b/src/shims/posix/fs.rs index 79539fd9c49e..d02410664bd4 100644 --- a/src/shims/posix/fs.rs +++ b/src/shims/posix/fs.rs @@ -304,7 +304,7 @@ pub struct FileHandler { handles: BTreeMap>, } -impl<'tcx> FileHandler { +impl FileHandler { pub(crate) fn new(mute_stdout_stderr: bool) -> FileHandler { let mut handles: BTreeMap<_, Box> = BTreeMap::new(); handles.insert(0i32, Box::new(io::stdin())); diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index 6cb71f43118c..a19e30b113e3 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -684,9 +684,9 @@ impl Stacks { state: &GlobalState, ) -> InterpResult<'tcx> { trace!("deallocation with tag {:?}: {:?}, size {}", tag, alloc_id, range.size.bytes()); - let mut state = state.borrow_mut(); + let state = state.borrow(); self.for_each_mut(range, |offset, stack, history| { - stack.dealloc(tag, (alloc_id, range, offset), &mut state, history) + stack.dealloc(tag, (alloc_id, range, offset), &state, history) })?; Ok(()) }