Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit bcc491a

Browse files
committed
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
1 parent f8840e6 commit bcc491a

File tree

7 files changed

+18
-18
lines changed

7 files changed

+18
-18
lines changed

benches/fibonacci.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::helpers::*;
77

88
#[bench]
99
fn fib(bencher: &mut Bencher) {
10-
bencher.iter(|| fibonacci_helper::main())
10+
bencher.iter(fibonacci_helper::main)
1111
}
1212

1313
#[bench]
@@ -17,7 +17,7 @@ fn fib_miri(bencher: &mut Bencher) {
1717

1818
#[bench]
1919
fn fib_iter(bencher: &mut Bencher) {
20-
bencher.iter(|| fibonacci_helper_iterative::main())
20+
bencher.iter(fibonacci_helper_iterative::main)
2121
}
2222

2323
#[bench]

benches/smoke.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::helpers::*;
77

88
#[bench]
99
fn noop(bencher: &mut Bencher) {
10-
bencher.iter(|| smoke_helper::main())
10+
bencher.iter(smoke_helper::main)
1111
}
1212

1313
/*

src/diagnostics.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,32 +166,32 @@ pub fn report_error<'tcx, 'mir>(
166166
match history {
167167
Some(TagHistory::Tagged {tag, created: (created_range, created_span), invalidated, protected }) => {
168168
let msg = format!("{:?} was created by a retag at offsets {}", tag, HexRange(*created_range));
169-
helps.push((Some(created_span.clone()), msg));
169+
helps.push((Some(*created_span), msg));
170170
if let Some((invalidated_range, invalidated_span)) = invalidated {
171171
let msg = format!("{:?} was later invalidated at offsets {}", tag, HexRange(*invalidated_range));
172-
helps.push((Some(invalidated_span.clone()), msg));
172+
helps.push((Some(*invalidated_span), msg));
173173
}
174174
if let Some((protecting_tag, protecting_tag_span, protection_span)) = protected {
175-
helps.push((Some(protecting_tag_span.clone()), format!("{:?} was protected due to {:?} which was created here", tag, protecting_tag)));
176-
helps.push((Some(protection_span.clone()), "this protector is live for this call".to_string()));
175+
helps.push((Some(*protecting_tag_span), format!("{:?} was protected due to {:?} which was created here", tag, protecting_tag)));
176+
helps.push((Some(*protection_span), "this protector is live for this call".to_string()));
177177
}
178178
}
179179
Some(TagHistory::Untagged{ recently_created, recently_invalidated, matching_created, protected }) => {
180180
if let Some((range, span)) = recently_created {
181181
let msg = format!("tag was most recently created at offsets {}", HexRange(*range));
182-
helps.push((Some(span.clone()), msg));
182+
helps.push((Some(*span), msg));
183183
}
184184
if let Some((range, span)) = recently_invalidated {
185185
let msg = format!("tag was later invalidated at offsets {}", HexRange(*range));
186-
helps.push((Some(span.clone()), msg));
186+
helps.push((Some(*span), msg));
187187
}
188188
if let Some((range, span)) = matching_created {
189189
let msg = format!("this tag was also created here at offsets {}", HexRange(*range));
190-
helps.push((Some(span.clone()), msg));
190+
helps.push((Some(*span), msg));
191191
}
192192
if let Some((protecting_tag, protecting_tag_span, protection_span)) = protected {
193-
helps.push((Some(protecting_tag_span.clone()), format!("{:?} was protected due to a tag which was created here", protecting_tag)));
194-
helps.push((Some(protection_span.clone()), "this protector is live for this call".to_string()));
193+
helps.push((Some(*protecting_tag_span), format!("{:?} was protected due to a tag which was created here", protecting_tag)));
194+
helps.push((Some(*protection_span), "this protector is live for this call".to_string()));
195195
}
196196
}
197197
None => {}

src/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,6 @@ mod tests {
491491
let cmd = String::from_utf16_lossy(&args_to_utf16_command_string(
492492
[r"C:\Program Files\", "arg1", "arg 2", "arg \" 3"].iter(),
493493
));
494-
assert_eq!(cmd.trim_end_matches("\0"), r#""C:\Program Files\" arg1 "arg 2" "arg \" 3""#);
494+
assert_eq!(cmd.trim_end_matches('\0'), r#""C:\Program Files\" arg1 "arg 2" "arg \" 3""#);
495495
}
496496
}

src/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -817,15 +817,15 @@ pub struct CurrentSpan<'a, 'mir, 'tcx> {
817817

818818
impl<'a, 'mir, 'tcx> CurrentSpan<'a, 'mir, 'tcx> {
819819
pub fn get(&mut self) -> Span {
820-
*self.span.get_or_insert_with(|| Self::current_span(&self.machine))
820+
*self.span.get_or_insert_with(|| Self::current_span(self.machine))
821821
}
822822

823823
#[inline(never)]
824824
fn current_span(machine: &Evaluator<'_, '_>) -> Span {
825825
machine
826826
.threads
827827
.active_thread_stack()
828-
.into_iter()
828+
.iter()
829829
.rev()
830830
.find(|frame| {
831831
let def_id = frame.instance.def_id();

src/shims/posix/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ pub struct FileHandler {
304304
handles: BTreeMap<i32, Box<dyn FileDescriptor>>,
305305
}
306306

307-
impl<'tcx> FileHandler {
307+
impl FileHandler {
308308
pub(crate) fn new(mute_stdout_stderr: bool) -> FileHandler {
309309
let mut handles: BTreeMap<_, Box<dyn FileDescriptor>> = BTreeMap::new();
310310
handles.insert(0i32, Box::new(io::stdin()));

src/stacked_borrows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,9 +684,9 @@ impl Stacks {
684684
state: &GlobalState,
685685
) -> InterpResult<'tcx> {
686686
trace!("deallocation with tag {:?}: {:?}, size {}", tag, alloc_id, range.size.bytes());
687-
let mut state = state.borrow_mut();
687+
let state = state.borrow();
688688
self.for_each_mut(range, |offset, stack, history| {
689-
stack.dealloc(tag, (alloc_id, range, offset), &mut state, history)
689+
stack.dealloc(tag, (alloc_id, range, offset), &state, history)
690690
})?;
691691
Ok(())
692692
}

0 commit comments

Comments
 (0)