Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cleanup: fix latest nightly lint warnings #1460

Merged
merged 2 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git-branchless-lib/src/core/effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ impl Drop for ProgressHandle<'_> {
}
}

impl<'a> ProgressHandle<'a> {
impl ProgressHandle<'_> {
/// Notify the progress meter that the current operation has `total`
/// discrete units of work, and it's currently `current` units of the way
/// through the operation.
Expand Down
10 changes: 5 additions & 5 deletions git-branchless-lib/src/core/node_descriptors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ pub enum NodeObject<'repo> {
},
}

impl<'repo> NodeObject<'repo> {
impl NodeObject<'_> {
fn get_oid(&self) -> NonZeroOid {
match self {
NodeObject::Commit { commit } => commit.get_oid(),
Expand Down Expand Up @@ -214,7 +214,7 @@ impl<'a> CommitMessageDescriptor<'a> {
}
}

impl<'a> NodeDescriptor for CommitMessageDescriptor<'a> {
impl NodeDescriptor for CommitMessageDescriptor<'_> {
#[instrument]
fn describe_node(
&mut self,
Expand Down Expand Up @@ -249,7 +249,7 @@ impl<'a> ObsolescenceExplanationDescriptor<'a> {
}
}

impl<'a> NodeDescriptor for ObsolescenceExplanationDescriptor<'a> {
impl NodeDescriptor for ObsolescenceExplanationDescriptor<'_> {
fn describe_node(
&mut self,
_glyphs: &Glyphs,
Expand Down Expand Up @@ -317,7 +317,7 @@ impl<'a> BranchesDescriptor<'a> {
}
}

impl<'a> NodeDescriptor for BranchesDescriptor<'a> {
impl NodeDescriptor for BranchesDescriptor<'_> {
#[instrument]
fn describe_node(
&mut self,
Expand Down Expand Up @@ -412,7 +412,7 @@ $",
Some(diff_number.to_owned())
}

impl<'a> NodeDescriptor for DifferentialRevisionDescriptor<'a> {
impl NodeDescriptor for DifferentialRevisionDescriptor<'_> {
#[instrument]
fn describe_node(
&mut self,
Expand Down
6 changes: 1 addition & 5 deletions git-branchless-lib/src/core/rewrite/evolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ pub fn find_rewrite_target(
event_cursor: EventCursor,
oid: NonZeroOid,
) -> Option<MaybeZeroOid> {
let event = event_replayer.get_cursor_commit_latest_event(event_cursor, oid);
let event = match event {
Some(event) => event,
None => return None,
};
let event = event_replayer.get_cursor_commit_latest_event(event_cursor, oid)?;
match event {
Event::RewriteEvent {
timestamp: _,
Expand Down
4 changes: 2 additions & 2 deletions git-branchless-lib/src/core/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub struct ResourceHandle<'pool, R: Resource> {
inner: Option<R::Output>,
}

impl<'a, R: Resource> Drop for ResourceHandle<'a, R> {
impl<R: Resource> Drop for ResourceHandle<'_, R> {
fn drop(&mut self) {
let mut resources = self
.parent
Expand All @@ -97,7 +97,7 @@ impl<'a, R: Resource> Drop for ResourceHandle<'a, R> {
}
}

impl<'a, R: Resource> Deref for ResourceHandle<'a, R> {
impl<R: Resource> Deref for ResourceHandle<'_, R> {
type Target = R::Output;

fn deref(&self) -> &Self::Target {
Expand Down
2 changes: 1 addition & 1 deletion git-branchless-lib/src/git/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ pub struct Blob<'repo> {
pub(super) inner: git2::Blob<'repo>,
}

impl<'repo> Blob<'repo> {
impl Blob<'_> {
/// Get the size of the blob in bytes.
pub fn size(&self) -> u64 {
self.inner.size().try_into().unwrap()
Expand Down
2 changes: 1 addition & 1 deletion git-branchless-lib/src/git/repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ pub enum AmendFastOptions<'repo> {
},
}

impl<'repo> AmendFastOptions<'repo> {
impl AmendFastOptions<'_> {
/// Returns whether there are any paths to be amended.
pub fn is_empty(&self) -> bool {
match &self {
Expand Down
2 changes: 1 addition & 1 deletion git-branchless-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ struct SearchGraph<'a> {
commit_set: CommitSet,
}

impl<'a> BasicSourceControlGraph for SearchGraph<'a> {
impl BasicSourceControlGraph for SearchGraph<'_> {
type Node = NonZeroOid;
type Error = SearchGraphError;

Expand Down
4 changes: 2 additions & 2 deletions scm-bisect/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ impl<G: Graph> Search<G> {
&'a self,
strategy: &'a S,
) -> Result<
LazySolution<G::Node, SearchError<G::Node, G::Error, S::Error>>,
LazySolution<'a, G::Node, SearchError<G::Node, G::Error, S::Error>>,
SearchError<G::Node, G::Error, S::Error>,
> {
let success_bounds = self.success_bounds().map_err(SearchError::Graph)?;
Expand All @@ -284,7 +284,7 @@ impl<G: Graph> Search<G> {
states: VecDeque<State<G>>,
}

impl<'a, G: Graph, S: Strategy<G>> Iterator for Iter<'a, G, S> {
impl<G: Graph, S: Strategy<G>> Iterator for Iter<'_, G, S> {
type Item = Result<G::Node, SearchError<G::Node, G::Error, S::Error>>;

fn next(&mut self) -> Option<Self::Item> {
Expand Down
10 changes: 10 additions & 0 deletions scm-bisect/src/testing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Testing utilities.

use std::collections::{HashMap, HashSet};
use std::convert::Infallible;

Expand All @@ -7,8 +9,12 @@ use proptest::prelude::*;

use crate::basic::{BasicSourceControlGraph, BasicStrategyKind};

/// Graph that represents a "stick" of nodes, represented as increasing
/// integers. The node `n` is the immediate parent of `n + 1`.
#[derive(Clone, Debug)]
pub struct UsizeGraph {
/// The maximum node value for this graph. Valid nodes are in `0..max` (a
/// half-open [`std::ops::Range`]).
pub max: usize,
}

Expand All @@ -27,8 +33,10 @@ impl BasicSourceControlGraph for UsizeGraph {
}
}

/// Directed acyclic graph with nodes `char` and edges `char -> char`.
#[derive(Clone, Debug)]
pub struct TestGraph {
/// Mapping from parent to children.
pub nodes: HashMap<char, HashSet<char>>,
}

Expand Down Expand Up @@ -57,6 +65,7 @@ impl BasicSourceControlGraph for TestGraph {
}
}

/// Select an arbitrary [`BasicStrategyKind`].
pub fn arb_strategy() -> impl ProptestStrategy<Value = BasicStrategyKind> {
prop_oneof![
Just(BasicStrategyKind::Linear),
Expand All @@ -65,6 +74,7 @@ pub fn arb_strategy() -> impl ProptestStrategy<Value = BasicStrategyKind> {
]
}

/// Create an arbitrary [`TestGraph`] and an arbitrary set of failing nodes.
pub fn arb_test_graph_and_nodes() -> impl ProptestStrategy<Value = (TestGraph, Vec<char>)> {
let nodes = prop::collection::hash_set(
prop::sample::select(vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']),
Expand Down
Loading