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
}

0 commit comments

Comments
 (0)