Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
clippy: Disallow lint `iter_nth_zero`
Lorenz Leutgeb committed 15 days ago
commit 63f96074231205fe0a87567333297acaf59d2c4d
parent f87d254
4 files changed +7 -8
modified crates/radicle/src/cob/issue.rs
@@ -1290,7 +1290,7 @@ mod test {

        let id = issue.id;
        let mut issue = issues.get_mut(&id).unwrap();
-
        let (_, reply1) = &issue.replies_to(&root).nth(0).unwrap();
+
        let (_, reply1) = &issue.replies_to(&root).next().unwrap();
        let (_, reply2) = &issue.replies_to(&root).nth(1).unwrap();

        assert_eq!(reply1.body(), "Hi hi hi.");
@@ -1303,8 +1303,8 @@ mod test {

        let issue = issues.get(&id).unwrap().unwrap();

-
        assert_eq!(issue.replies_to(&c1).nth(0).unwrap().1.body(), "Re: Hi.");
-
        assert_eq!(issue.replies_to(&c2).nth(0).unwrap().1.body(), "Re: Ha.");
+
        assert_eq!(issue.replies_to(&c1).next().unwrap().1.body(), "Re: Hi.");
+
        assert_eq!(issue.replies_to(&c2).next().unwrap().1.body(), "Re: Ha.");
        assert_eq!(
            issue.replies_to(&c2).nth(1).unwrap().1.body(),
            "Re: Ha. Ha."
@@ -1370,7 +1370,7 @@ mod test {

        let id = issue.id;
        let issue = issues.get(&id).unwrap().unwrap();
-
        let (_, c0) = &issue.comments().nth(0).unwrap();
+
        let (_, c0) = &issue.comments().next().unwrap();
        let (_, c1) = &issue.comments().nth(1).unwrap();
        let (_, c2) = &issue.comments().nth(2).unwrap();

modified crates/radicle/src/cob/patch.rs
@@ -3386,7 +3386,7 @@ mod test {
        let review = revision.review_by(alice.signer.public_key()).unwrap();
        assert_eq!(review.verdict(), Some(Verdict::Reject));
        assert_eq!(review.comments().count(), 2);
-
        assert_eq!(review.comments().nth(0).unwrap().1.body(), "First comment!");
+
        assert_eq!(review.comments().next().unwrap().1.body(), "First comment!");
        assert_eq!(
            review.comments().nth(1).unwrap().1.body(),
            "Second comment!"
@@ -3517,7 +3517,7 @@ mod test {
        assert_eq!(patch.revisions.len(), 2);
        assert_eq!(patch.revisions().count(), 2);
        assert_eq!(
-
            patch.revisions().nth(0).unwrap().1.description(),
+
            patch.revisions().next().unwrap().1.description(),
            "Blah blah blah."
        );
        assert_eq!(
modified crates/radicle/src/cob/thread.rs
@@ -714,7 +714,7 @@ mod tests {
        let a3 = alice.redact(a1.id());
        thread.op(a3, [], &repo).unwrap();

-
        let (_, comment0) = thread.comments().nth(0).unwrap();
+
        let (_, comment0) = thread.comments().next().unwrap();
        let (_, comment1) = thread.comments().nth(1).unwrap();

        assert_eq!(thread.comments().count(), 2);
modified crates/radicle/src/lib.rs
@@ -1,5 +1,4 @@
#![allow(clippy::too_many_arguments)]
-
#![allow(clippy::iter_nth_zero)]
#![warn(clippy::unwrap_used)]

pub extern crate radicle_crypto as crypto;