Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvdb committed Jan 19, 2025
1 parent c694f27 commit 4a05ae1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/krate_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ impl<'name> TryFrom<&'name str> for KrateName<'name> {
}
}

impl<'name> KrateName<'name> {
impl KrateName<'_> {
/// Writes the crate's prefix to the specified string
///
/// Cargo uses a simple prefix in the registry index so that crate's can be
Expand Down Expand Up @@ -259,14 +259,14 @@ impl<'name> KrateName<'name> {

use std::fmt;

impl<'k> fmt::Display for KrateName<'k> {
impl fmt::Display for KrateName<'_> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.0)
}
}

impl<'k> fmt::Debug for KrateName<'k> {
impl fmt::Debug for KrateName<'_> {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.write_str(self.0)
Expand Down
4 changes: 2 additions & 2 deletions src/utils/flock/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ pub(super) fn is_unsupported(err: &std::io::Error) -> bool {

#[inline]
pub(super) fn is_contended(err: &Error) -> bool {
err.raw_os_error().map_or(false, |x| x == libc::EWOULDBLOCK)
err.raw_os_error() == Some(libc::EWOULDBLOCK)
}

#[inline]
pub(super) fn is_timed_out(err: &Error) -> bool {
err.raw_os_error().map_or(false, |x| x == libc::EINTR)
err.raw_os_error() == Some(libc::EINTR)
}
11 changes: 4 additions & 7 deletions src/utils/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,10 @@ pub fn write_fetch_head(
}

rspec.local().map_or(false, |l| {
l.to_str()
.ok()
.and_then(|l| {
l.strip_prefix("refs/remotes/")
.and_then(|l| l.strip_suffix("/HEAD"))
})
.map_or(false, |remote| remote == remote_name)
l.to_str().ok().and_then(|l| {
l.strip_prefix("refs/remotes/")
.and_then(|l| l.strip_suffix("/HEAD"))
}) == Some(remote_name)
})
})
{
Expand Down

0 comments on commit 4a05ae1

Please sign in to comment.