Skip to content

Commit 95c06a2

Browse files
committed
Apply clippy::needless_return suggestions
1 parent dffc1b3 commit 95c06a2

File tree

16 files changed

+23
-23
lines changed

16 files changed

+23
-23
lines changed

src/liballoc/collections/vec_deque.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1817,7 +1817,7 @@ impl<T> VecDeque<T> {
18171817
}
18181818
}
18191819

1820-
return elem;
1820+
elem
18211821
}
18221822

18231823
/// Splits the `VecDeque` into two at the given index.

src/liballoc/str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ impl str {
456456
}
457457
}
458458
}
459-
return s;
459+
s
460460
}
461461

462462
/// Converts a [`Box<str>`] into a [`String`] without copying or allocating.

src/liballoc/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ impl<T: ?Sized> Clone for Weak<T> {
16381638
}
16391639
}
16401640

1641-
return Weak { ptr: self.ptr };
1641+
Weak { ptr: self.ptr }
16421642
}
16431643
}
16441644

src/libpanic_unwind/gcc.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,21 +156,21 @@ unsafe extern "C" fn rust_eh_personality(version: c_int,
156156
if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 {
157157
match eh_action {
158158
EHAction::None |
159-
EHAction::Cleanup(_) => return uw::_URC_CONTINUE_UNWIND,
160-
EHAction::Catch(_) => return uw::_URC_HANDLER_FOUND,
161-
EHAction::Terminate => return uw::_URC_FATAL_PHASE1_ERROR,
159+
EHAction::Cleanup(_) => uw::_URC_CONTINUE_UNWIND,
160+
EHAction::Catch(_) => uw::_URC_HANDLER_FOUND,
161+
EHAction::Terminate => uw::_URC_FATAL_PHASE1_ERROR,
162162
}
163163
} else {
164164
match eh_action {
165-
EHAction::None => return uw::_URC_CONTINUE_UNWIND,
165+
EHAction::None => uw::_URC_CONTINUE_UNWIND,
166166
EHAction::Cleanup(lpad) |
167167
EHAction::Catch(lpad) => {
168168
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.0, exception_object as uintptr_t);
169169
uw::_Unwind_SetGR(context, UNWIND_DATA_REG.1, 0);
170170
uw::_Unwind_SetIP(context, lpad);
171-
return uw::_URC_INSTALL_CONTEXT;
171+
uw::_URC_INSTALL_CONTEXT
172172
}
173-
EHAction::Terminate => return uw::_URC_FATAL_PHASE2_ERROR,
173+
EHAction::Terminate => uw::_URC_FATAL_PHASE2_ERROR,
174174
}
175175
}
176176
}

src/libpanic_unwind/seh64_gnu.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn payload() -> *mut u8 {
4646

4747
pub unsafe fn cleanup(ptr: *mut u8) -> Box<dyn Any + Send> {
4848
let panic_ctx = Box::from_raw(ptr as *mut PanicData);
49-
return panic_ctx.data;
49+
panic_ctx.data
5050
}
5151

5252
// SEH doesn't support resuming unwinds after calling a landing pad like

src/libstd/panicking.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pub fn update_panic_count(amt: isize) -> usize {
217217
PANIC_COUNT.with(|c| {
218218
let next = (c.get() as isize + amt) as usize;
219219
c.set(next);
220-
return next
220+
next
221221
})
222222
}
223223

src/libstd/sys/unix/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {
88
mem::size_of_val(&v));
99
imp::fill_bytes(view);
1010
}
11-
return v
11+
v
1212
}
1313

1414
#[cfg(all(unix,

src/libstd/sys/windows/handle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ impl Handle {
4646
pub fn into_raw(self) -> c::HANDLE {
4747
let ret = self.raw();
4848
mem::forget(self);
49-
return ret;
49+
ret
5050
}
5151
}
5252

src/libstd/sys/windows/mutex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ fn kind() -> Kind {
144144
Some(..) => Kind::SRWLock,
145145
};
146146
KIND.store(ret as usize, Ordering::SeqCst);
147-
return ret;
147+
ret
148148
}
149149

150150
pub struct ReentrantMutex { inner: UnsafeCell<MaybeUninit<c::CRITICAL_SECTION>> }

src/libstd/sys/windows/process.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl Stdio {
257257
let ret = io.duplicate(0, true,
258258
c::DUPLICATE_SAME_ACCESS);
259259
io.into_raw();
260-
return ret
260+
ret
261261
}
262262
Err(..) => Ok(Handle::new(c::INVALID_HANDLE_VALUE)),
263263
}

src/libstd/sys/windows/rand.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub fn hashmap_random_keys() -> (u64, u64) {
1313
panic!("couldn't generate random bytes: {}",
1414
io::Error::last_os_error());
1515
}
16-
return v
16+
v
1717
}
1818

1919
#[cfg(target_vendor = "uwp")]

src/libstd/sys/windows/thread_local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub unsafe fn create(dtor: Option<Dtor>) -> Key {
5252
if let Some(f) = dtor {
5353
register_dtor(key, f);
5454
}
55-
return key;
55+
key
5656
}
5757

5858
#[inline]

src/libstd/sys/windows/time.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl SystemTime {
8080
unsafe {
8181
let mut t: SystemTime = mem::zeroed();
8282
c::GetSystemTimeAsFileTime(&mut t.t);
83-
return t
83+
t
8484
}
8585
}
8686

@@ -228,7 +228,7 @@ mod perf_counter {
228228
FREQUENCY = frequency;
229229
STATE.store(2, SeqCst);
230230
}
231-
return frequency;
231+
frequency
232232
}
233233
}
234234

src/libtest/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl Bencher {
4848
F: FnMut(&mut Bencher),
4949
{
5050
f(self);
51-
return self.summary;
51+
self.summary
5252
}
5353
}
5454

@@ -116,7 +116,7 @@ where
116116
for _ in 0..k {
117117
black_box(inner());
118118
}
119-
return ns_from_dur(start.elapsed());
119+
ns_from_dur(start.elapsed())
120120
}
121121

122122
pub fn iter<T, F>(inner: &mut F) -> stats::Summary

src/libtest/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn optgroups() -> getopts::Options {
149149
`CRITICAL_TIME` here means the limit that should not be exceeded by test.
150150
"
151151
);
152-
return opts;
152+
opts
153153
}
154154

155155
fn usage(binary: &str, options: &getopts::Options) {

src/libtest/console.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ pub fn run_tests_console(opts: &TestOpts, tests: Vec<TestDescAndFn>) -> io::Resu
296296

297297
assert!(st.current_test_count() == st.total);
298298

299-
return out.write_run_finish(&st);
299+
out.write_run_finish(&st)
300300
}
301301

302302
// Calculates padding for given test description.

0 commit comments

Comments
 (0)