Skip to content

Commit 9c47913

Browse files
authored
Rollup merge of #89707 - clemenswasser:apply_clippy_suggestions, r=Mark-Simulacrum
Apply clippy suggestions for std
2 parents 1b8f7a9 + 8545472 commit 9c47913

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

library/std/src/io/buffered/bufreader.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,13 @@ impl<R: Seek> BufReader<R> {
242242
self.pos = new_pos as usize;
243243
return Ok(());
244244
}
245-
} else {
246-
if let Some(new_pos) = pos.checked_add(offset as u64) {
247-
if new_pos <= self.cap as u64 {
248-
self.pos = new_pos as usize;
249-
return Ok(());
250-
}
245+
} else if let Some(new_pos) = pos.checked_add(offset as u64) {
246+
if new_pos <= self.cap as u64 {
247+
self.pos = new_pos as usize;
248+
return Ok(());
251249
}
252250
}
251+
253252
self.seek(SeekFrom::Current(offset)).map(drop)
254253
}
255254
}

library/std/src/sys/windows/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl IntoInner<Handle> for File {
558558

559559
impl FromInner<Handle> for File {
560560
fn from_inner(handle: Handle) -> File {
561-
File { handle: handle }
561+
File { handle }
562562
}
563563
}
564564

@@ -672,7 +672,7 @@ impl FilePermissions {
672672

673673
impl FileType {
674674
fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType {
675-
FileType { attributes: attrs, reparse_tag: reparse_tag }
675+
FileType { attributes: attrs, reparse_tag }
676676
}
677677
pub fn is_dir(&self) -> bool {
678678
!self.is_symlink() && self.is_directory()

library/std/src/sys/windows/stack_overflow.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ impl Handler {
99
pub unsafe fn new() -> Handler {
1010
// This API isn't available on XP, so don't panic in that case and just
1111
// pray it works out ok.
12-
if c::SetThreadStackGuarantee(&mut 0x5000) == 0 {
13-
if c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32 {
14-
panic!("failed to reserve stack space for exception handling");
15-
}
12+
if c::SetThreadStackGuarantee(&mut 0x5000) == 0
13+
&& c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32
14+
{
15+
panic!("failed to reserve stack space for exception handling");
1616
}
1717
Handler
1818
}

library/std/src/sys_common/backtrace.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,8 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
9393
if stop {
9494
return false;
9595
}
96-
if !hit {
97-
if start {
98-
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
99-
}
96+
if !hit && start {
97+
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
10098
}
10199

102100
idx += 1;

0 commit comments

Comments
 (0)