Skip to content

Commit 519755a

Browse files
committed
Resolve clippy::needless_return
error: unneeded `return` statement --> src/helpers.rs:734:13 | 734 | return Ok(()); | ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())` | = note: `-D clippy::needless-return` implied by `-D clippy::all` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return error: unneeded `return` statement --> src/range_map.rs:113:9 | 113 | return true; | ^^^^^^^^^^^^ help: remove `return`: `true` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return error: unneeded `return` statement --> src/shims/posix/fs.rs:648:25 | 648 | None => return this.handle_not_found(), | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `this.handle_not_found()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return error: unneeded `return` statement --> src/shims/panic.rs:62:9 | 62 | return Ok(()); | ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return error: unneeded `return` statement --> src/shims/panic.rs:115:9 | 115 | return Ok(()); | ^^^^^^^^^^^^^^ help: remove `return`: `Ok(())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return error: unneeded `return` statement --> src/thread.rs:477:9 | 477 | return free_tls_statics; | ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove `return`: `free_tls_statics` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return error: unneeded `return` statement --> src/thread.rs:459:17 | 459 | return false; | ^^^^^^^^^^^^^ help: remove `return`: `false` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return
1 parent 6e2297f commit 519755a

File tree

6 files changed

+7
-8
lines changed

6 files changed

+7
-8
lines changed

src/helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
731731
// message is slightly different here to make automated analysis easier
732732
let error_msg = format!("unsupported Miri functionality: {}", error_msg.as_ref());
733733
this.start_panic(error_msg.as_ref(), StackPopUnwind::Skip)?;
734-
return Ok(());
734+
Ok(())
735735
} else {
736736
throw_unsup_format!("{}", error_msg.as_ref());
737737
}

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
clippy::if_same_then_else,
2020
clippy::manual_map,
2121
clippy::needless_lifetimes,
22-
clippy::needless_return,
2322
clippy::new_without_default,
2423
clippy::op_ref,
2524
clippy::redundant_closure,

src/range_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<T> RangeMap<T> {
110110
// Copy the data, and insert second element.
111111
let second = Elem { range: second_range, data: elem.data.clone() };
112112
self.v.insert(index + 1, second);
113-
return true;
113+
true
114114
}
115115

116116
/// Provides mutable iteration over everything in the given range. As a side-effect,

src/shims/panic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
5959

6060
// Jump to the unwind block to begin unwinding.
6161
this.unwind_to_block(unwind)?;
62-
return Ok(());
62+
Ok(())
6363
}
6464

6565
/// Handles the `try` intrinsic, the underlying implementation of `std::panicking::try`.
@@ -112,7 +112,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
112112
Some(CatchUnwindData { catch_fn, data, dest: *dest, ret });
113113
}
114114

115-
return Ok(());
115+
Ok(())
116116
}
117117

118118
fn handle_stack_pop(

src/shims/posix/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
645645
}
646646
}
647647
}
648-
None => return this.handle_not_found(),
648+
None => this.handle_not_found(),
649649
}
650650
} else if this.tcx.sess.target.os == "macos" && cmd == this.eval_libc_i32("F_FULLFSYNC")? {
651651
if let Some(file_descriptor) = this.machine.file_handler.handles.get(&fd) {

src/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
456456
// Delete this static from the map and from memory.
457457
// We cannot free directly here as we cannot use `?` in this context.
458458
free_tls_statics.push(alloc_id);
459-
return false;
459+
false
460460
});
461461
}
462462
// Set the thread into a terminated state in the data-race detector
@@ -474,7 +474,7 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> {
474474
thread.state = ThreadState::Enabled;
475475
}
476476
}
477-
return free_tls_statics;
477+
free_tls_statics
478478
}
479479

480480
/// Decide which action to take next and on which thread.

0 commit comments

Comments
 (0)