Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Dec 7, 2020
1 parent 61816e5 commit ba9b3c2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion git-commitgraph/src/file/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl<'a> Eq for Commit<'a> {}

impl<'a> PartialEq for Commit<'a> {
fn eq(&self, other: &Self) -> bool {
self.file as *const File == other.file as *const File && self.pos == other.pos
std::ptr::eq(self.file, other.file) && self.pos == other.pos
}
}

Expand Down
8 changes: 2 additions & 6 deletions git-object/src/borrowed/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub(crate) const NL: &[u8] = b"\n";
pub(crate) const SPACE: &[u8] = b" ";
pub(crate) const SPACE_OR_NL: &[u8] = b" \n";

pub(crate) fn any_header_field_multi_line<'a>(i: &'a [u8]) -> IResult<&'a [u8], (&'a [u8], BString), Error> {
pub(crate) fn any_header_field_multi_line(i: &[u8]) -> IResult<&[u8], (&[u8], BString), Error> {
let (i, (k, o)) = peek(tuple((
terminated(is_not(SPACE_OR_NL), tag(SPACE)),
recognize(tuple((
Expand Down Expand Up @@ -61,11 +61,7 @@ pub(crate) fn any_header_field<'a, T>(
}

fn is_hex_digit_lc(b: u8) -> bool {
match b {
b'0'..=b'9' => true,
b'a'..=b'f' => true,
_ => false,
}
matches!(b, b'0'..=b'9' | b'a'..=b'f')
}

pub(crate) fn hex_sha1(i: &[u8]) -> IResult<&[u8], &BStr, Error> {
Expand Down
11 changes: 4 additions & 7 deletions git-object/src/owned/convert.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use crate::{borrowed, owned};
use smallvec::SmallVec;
use std::iter::FromIterator;

impl Into<owned::Signature> for borrowed::Signature<'_> {
fn into(self) -> owned::Signature {
Expand Down Expand Up @@ -47,11 +45,10 @@ impl Into<owned::Commit> for borrowed::Commit<'_> {
} = self;
owned::Commit {
tree: owned::Id::from_40_bytes_in_hex(&tree).expect("40 bytes hex sha1"),
parents: SmallVec::from_iter(
parents
.iter()
.map(|parent| owned::Id::from_40_bytes_in_hex(parent).expect("40 bytes hex sha1")),
),
parents: parents
.iter()
.map(|parent| owned::Id::from_40_bytes_in_hex(parent).expect("40 bytes hex sha1"))
.collect(),
author: author.into(),
committer: committer.into(),
encoding: encoding.map(ToOwned::to_owned),
Expand Down
4 changes: 2 additions & 2 deletions git-odb/src/pack/index/access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct Entry {

/// Iteration and access
impl index::File {
pub(crate) fn iter_v1<'a>(&'a self) -> impl Iterator<Item = Entry> + 'a {
pub(crate) fn iter_v1(&self) -> impl Iterator<Item = Entry> + '_ {
match self.version {
index::Version::V1 => self.data[V1_HEADER_SIZE..]
.chunks(N32_SIZE + SHA1_SIZE)
Expand All @@ -48,7 +48,7 @@ impl index::File {
}
}

pub(crate) fn iter_v2<'a>(&'a self) -> impl Iterator<Item = Entry> + 'a {
pub(crate) fn iter_v2(&self) -> impl Iterator<Item = Entry> + '_ {
let pack64_offset = self.offset_pack_offset64_v2();
match self.version {
index::Version::V2 => izip!(
Expand Down
6 changes: 4 additions & 2 deletions git-odb/src/pack/index/traverse/reduce.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ where
pack_data_len_in_bytes: usize,
check: traverse::SafetyCheck,
) -> Self {
let mut stats = traverse::Outcome::default();
stats.pack_size = pack_data_len_in_bytes as u64;
let stats = traverse::Outcome {
pack_size: pack_data_len_in_bytes as u64,
..Default::default()
};
Reducer {
progress: &progress,
check,
Expand Down
2 changes: 1 addition & 1 deletion git-transport/src/client/http/curl/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl Handler {
}
fn parse_status(data: &[u8]) -> Option<(usize, Box<dyn std::error::Error + Send + Sync>)> {
match Self::parse_status_inner(data) {
Ok(status) if status < 200 || status > 299 => {
Ok(status) if !(200..=299).contains(&status) => {
Some((status, format!("Received HTTP status {}", status).into()))
}
Ok(_) => None,
Expand Down

0 comments on commit ba9b3c2

Please sign in to comment.