Rollup merge of #89707 - clemenswasser:apply_clippy_suggestions, r=Mark-Simulacrum

Apply clippy suggestions for std
This commit is contained in:
Matthias Krüger
2021-10-11 00:34:39 +02:00
committed by GitHub
4 changed files with 13 additions and 16 deletions
+5 -6
View File
@@ -242,14 +242,13 @@ pub fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
self.pos = new_pos as usize;
return Ok(());
}
} else {
if let Some(new_pos) = pos.checked_add(offset as u64) {
if new_pos <= self.cap as u64 {
self.pos = new_pos as usize;
return Ok(());
}
} else if let Some(new_pos) = pos.checked_add(offset as u64) {
if new_pos <= self.cap as u64 {
self.pos = new_pos as usize;
return Ok(());
}
}
self.seek(SeekFrom::Current(offset)).map(drop)
}
}
+2 -2
View File
@@ -558,7 +558,7 @@ fn into_inner(self) -> Handle {
impl FromInner<Handle> for File {
fn from_inner(handle: Handle) -> File {
File { handle: handle }
File { handle }
}
}
@@ -672,7 +672,7 @@ pub fn set_readonly(&mut self, readonly: bool) {
impl FileType {
fn new(attrs: c::DWORD, reparse_tag: c::DWORD) -> FileType {
FileType { attributes: attrs, reparse_tag: reparse_tag }
FileType { attributes: attrs, reparse_tag }
}
pub fn is_dir(&self) -> bool {
!self.is_symlink() && self.is_directory()
@@ -9,10 +9,10 @@ impl Handler {
pub unsafe fn new() -> Handler {
// This API isn't available on XP, so don't panic in that case and just
// pray it works out ok.
if c::SetThreadStackGuarantee(&mut 0x5000) == 0 {
if c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32 {
panic!("failed to reserve stack space for exception handling");
}
if c::SetThreadStackGuarantee(&mut 0x5000) == 0
&& c::GetLastError() as u32 != c::ERROR_CALL_NOT_IMPLEMENTED as u32
{
panic!("failed to reserve stack space for exception handling");
}
Handler
}
+2 -4
View File
@@ -93,10 +93,8 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt::
if stop {
return false;
}
if !hit {
if start {
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
}
if !hit && start {
res = bt_fmt.frame().print_raw(frame.ip(), None, None, None);
}
idx += 1;