Skip to content

Commit

Permalink
thanks clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Aug 9, 2022
1 parent 60780cc commit b9e1cdb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions git-refspec/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub use parse::function::parse;
pub mod instruction;

/// A refspec with references to the memory it was parsed from.
#[derive(Ord, Eq, Copy, Clone, Debug)]
#[derive(Eq, Copy, Clone, Debug)]
pub struct RefSpecRef<'a> {
mode: types::Mode,
op: parse::Operation,
Expand All @@ -19,7 +19,7 @@ pub struct RefSpecRef<'a> {
}

/// An owned refspec.
#[derive(Ord, Eq, Clone, Debug)]
#[derive(Eq, Clone, Debug)]
pub struct RefSpec {
mode: types::Mode,
op: parse::Operation,
Expand Down
12 changes: 12 additions & 0 deletions git-refspec/src/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ mod impls {
self.to_ref().partial_cmp(&other.to_ref())
}
}

impl Ord for RefSpecRef<'_> {
fn cmp(&self, other: &Self) -> Ordering {
self.instruction().cmp(&other.instruction())
}
}

impl Ord for RefSpec {
fn cmp(&self, other: &Self) -> Ordering {
self.to_ref().cmp(&other.to_ref())
}
}
}

/// Access
Expand Down

0 comments on commit b9e1cdb

Please sign in to comment.