Skip to content

Commit 554ce13

Browse files
committed
thanks clippy
With latest nightly
1 parent 378b1be commit 554ce13

File tree

8 files changed

+17
-18
lines changed

8 files changed

+17
-18
lines changed

gix-attributes/tests/parse/mod.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -322,15 +322,15 @@ fn trailing_whitespace_in_attributes_is_ignored() {
322322

323323
type ExpandedAttribute<'a> = (parse::Kind, Vec<(BString, gix_attributes::StateRef<'a>)>, usize);
324324

325-
fn set(attr: &str) -> (BString, StateRef) {
325+
fn set(attr: &str) -> (BString, StateRef<'_>) {
326326
(attr.into(), StateRef::Set)
327327
}
328328

329-
fn unset(attr: &str) -> (BString, StateRef) {
329+
fn unset(attr: &str) -> (BString, StateRef<'_>) {
330330
(attr.into(), StateRef::Unset)
331331
}
332332

333-
fn unspecified(attr: &str) -> (BString, StateRef) {
333+
fn unspecified(attr: &str) -> (BString, StateRef<'_>) {
334334
(attr.into(), StateRef::Unspecified)
335335
}
336336

@@ -350,36 +350,36 @@ fn pattern(name: &str, flags: gix_glob::pattern::Mode, first_wildcard_pos: Optio
350350
})
351351
}
352352

353-
fn try_line(input: &str) -> Result<ExpandedAttribute, parse::Error> {
353+
fn try_line(input: &str) -> Result<ExpandedAttribute<'_>, parse::Error> {
354354
let mut lines = gix_attributes::parse(input.as_bytes());
355355
let res = expand(lines.next().unwrap())?;
356356
assert!(lines.next().is_none(), "expected only one line");
357357
Ok(res)
358358
}
359359

360-
fn line(input: &str) -> ExpandedAttribute {
360+
fn line(input: &str) -> ExpandedAttribute<'_> {
361361
try_line(input).unwrap()
362362
}
363363

364-
fn byte_line(input: &[u8]) -> ExpandedAttribute {
364+
fn byte_line(input: &[u8]) -> ExpandedAttribute<'_> {
365365
try_byte_line(input).unwrap()
366366
}
367367

368-
fn try_byte_line(input: &[u8]) -> Result<ExpandedAttribute, parse::Error> {
368+
fn try_byte_line(input: &[u8]) -> Result<ExpandedAttribute<'_>, parse::Error> {
369369
let mut lines = gix_attributes::parse(input);
370370
let res = expand(lines.next().unwrap())?;
371371
assert!(lines.next().is_none(), "expected only one line");
372372
Ok(res)
373373
}
374374

375-
fn lenient_lines(input: &str) -> Vec<ExpandedAttribute> {
375+
fn lenient_lines(input: &str) -> Vec<ExpandedAttribute<'_>> {
376376
gix_attributes::parse(input.as_bytes())
377377
.map(expand)
378378
.filter_map(Result::ok)
379379
.collect()
380380
}
381381

382-
fn try_lines(input: &str) -> Result<Vec<ExpandedAttribute>, parse::Error> {
382+
fn try_lines(input: &str) -> Result<Vec<ExpandedAttribute<'_>>, parse::Error> {
383383
gix_attributes::parse(input.as_bytes()).map(expand).collect()
384384
}
385385

gix-config/tests/config/parse/section.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ mod header {
1111

1212
use bstr::BStr;
1313

14-
fn cow_section(name: &str) -> Option<Cow<BStr>> {
14+
fn cow_section(name: &str) -> Option<Cow<'_, BStr>> {
1515
Some(Cow::Borrowed(name.into()))
1616
}
1717
mod write_to {

gix-odb/src/store_impls/dynamic/load_index.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,7 @@ impl PartialEq<Self> for Either {
734734
}
735735
}
736736

737+
#[allow(clippy::non_canonical_partial_ord_impl)]
737738
impl PartialOrd<Self> for Either {
738739
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
739740
Some(self.path().cmp(other.path()))

gix-ref/src/name.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ impl<'a> convert::TryFrom<&'a str> for PartialName {
221221
}
222222
}
223223

224+
#[allow(clippy::infallible_try_from)]
224225
impl<'a> convert::TryFrom<&'a FullName> for &'a PartialNameRef {
225226
type Error = Infallible;
226227

gix-refspec/src/spec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ mod impls {
6969
}
7070
}
7171

72+
#[allow(clippy::non_canonical_partial_ord_impl)]
7273
impl PartialOrd for RefSpec {
7374
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
7475
Some(self.to_ref().cmp(&other.to_ref()))

gix/tests/gix-init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ mod with_overrides {
268268
Ok(())
269269
}
270270

271-
fn cow_bstr(s: &str) -> Cow<BStr> {
271+
fn cow_bstr(s: &str) -> Cow<'_, BStr> {
272272
Cow::Borrowed(s.into())
273273
}
274274
}

gix/tests/gix/object/tree/diff.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ mod track_rewrites {
879879
}
880880
}
881881

882-
fn tree_named(repo: &gix::Repository, rev_spec: impl AsRef<str>) -> gix::Tree {
882+
fn tree_named(repo: &gix::Repository, rev_spec: impl AsRef<str>) -> gix::Tree<'_> {
883883
repo.rev_parse_single(rev_spec.as_ref())
884884
.unwrap()
885885
.object()

tests/it/src/commands/blame_copy_royal.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,10 @@ git rm {src}
161161
"
162162
),
163163
BlameScriptOperation::CommitFile(src, commit_id) => {
164-
write!(
165-
f,
166-
r"# make file {src} contain content at commit {commit_id}
167-
"
168-
)?;
164+
writeln!(f, r"# make file {src} contain content at commit {commit_id}")?;
169165
if let Some(pos) = src.rfind_byte(b'/') {
170166
let dirname = src[..pos].as_bstr();
171-
write!(f, "mkdir -p \"{dirname}\"\n")?;
167+
writeln!(f, "mkdir -p \"{dirname}\"")?;
172168
}
173169
write!(
174170
f,

0 commit comments

Comments
 (0)