Auto merge of #2186 - matthiaskrgr:clippy, r=RalfJung
clippy fixes clippy::redundant_closure clippy::unnecessary_mut_passed clippy::single_char_pattern clippy::clone_on_copy clippy::into_iter_on_ref clippy::extra_unused_lifetimes
This commit is contained in:
commit
92c2e3c0bc
@ -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]
|
||||
|
@ -7,7 +7,7 @@ use crate::helpers::*;
|
||||
|
||||
#[bench]
|
||||
fn noop(bencher: &mut Bencher) {
|
||||
bencher.iter(|| smoke_helper::main())
|
||||
bencher.iter(smoke_helper::main)
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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 => {}
|
||||
|
@ -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""#);
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -304,7 +304,7 @@ pub struct FileHandler {
|
||||
handles: BTreeMap<i32, Box<dyn FileDescriptor>>,
|
||||
}
|
||||
|
||||
impl<'tcx> FileHandler {
|
||||
impl FileHandler {
|
||||
pub(crate) fn new(mute_stdout_stderr: bool) -> FileHandler {
|
||||
let mut handles: BTreeMap<_, Box<dyn FileDescriptor>> = BTreeMap::new();
|
||||
handles.insert(0i32, Box::new(io::stdin()));
|
||||
|
@ -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(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user