History

thanks clippy

With latest nightly

Sebastian Thiel committed 1 year ago

Commit 554ce131 parent 378b1be8 files · +17 −18Browse files

Unified · Split

8 files
  1. gix-attributes/tests/parse/mod.rs +9 −9
  2. gix-config/tests/config/parse/section.rs +1 −1
  3. gix-odb/src/store_impls/dynamic/load_index.rs +1 −0
  4. gix-ref/src/name.rs +1 −0
  5. gix-refspec/src/spec.rs +1 −0
  6. gix/tests/gix-init.rs +1 −1
  7. gix/tests/gix/object/tree/diff.rs +1 −1
  8. tests/it/src/commands/blame_copy_royal.rs +2 −6
gix-attributes/tests/parse/mod.rs+9−9
@@ -322,15 +322,15 @@ fn trailing_whitespace_in_attributes_is_ignored() { · 321 unmodified lines
322 322
323type ExpandedAttribute<'a> = (parse::Kind, Vec<(BString, gix_attributes::StateRef<'a>)>, usize);323type ExpandedAttribute<'a> = (parse::Kind, Vec<(BString, gix_attributes::StateRef<'a>)>, usize);
324 324
325fn set(attr: &str) -> (BString, StateRef) {325fn set(attr: &str) -> (BString, StateRef<'_>) {
326 (attr.into(), StateRef::Set)326 (attr.into(), StateRef::Set)
327}327}
328 328
329fn unset(attr: &str) -> (BString, StateRef) {329fn unset(attr: &str) -> (BString, StateRef<'_>) {
330 (attr.into(), StateRef::Unset)330 (attr.into(), StateRef::Unset)
331}331}
332 332
333fn unspecified(attr: &str) -> (BString, StateRef) {333fn unspecified(attr: &str) -> (BString, StateRef<'_>) {
334 (attr.into(), StateRef::Unspecified)334 (attr.into(), StateRef::Unspecified)
335}335}
336 336
@@ -350,36 +350,36 @@ fn pattern(name: &str, flags: gix_glob::pattern::Mode, first_wildcard_pos: Optio · 13 unmodified lines
350 })350 })
351}351}
352 352
353fn try_line(input: &str) -> Result<ExpandedAttribute, parse::Error> {353fn try_line(input: &str) -> Result<ExpandedAttribute<'_>, parse::Error> {
354 let mut lines = gix_attributes::parse(input.as_bytes());354 let mut lines = gix_attributes::parse(input.as_bytes());
355 let res = expand(lines.next().unwrap())?;355 let res = expand(lines.next().unwrap())?;
356 assert!(lines.next().is_none(), "expected only one line");356 assert!(lines.next().is_none(), "expected only one line");
357 Ok(res)357 Ok(res)
358}358}
359 359
360fn line(input: &str) -> ExpandedAttribute {360fn line(input: &str) -> ExpandedAttribute<'_> {
361 try_line(input).unwrap()361 try_line(input).unwrap()
362}362}
363 363
364fn byte_line(input: &[u8]) -> ExpandedAttribute {364fn byte_line(input: &[u8]) -> ExpandedAttribute<'_> {
365 try_byte_line(input).unwrap()365 try_byte_line(input).unwrap()
366}366}
367 367
368fn try_byte_line(input: &[u8]) -> Result<ExpandedAttribute, parse::Error> {368fn try_byte_line(input: &[u8]) -> Result<ExpandedAttribute<'_>, parse::Error> {
369 let mut lines = gix_attributes::parse(input);369 let mut lines = gix_attributes::parse(input);
370 let res = expand(lines.next().unwrap())?;370 let res = expand(lines.next().unwrap())?;
371 assert!(lines.next().is_none(), "expected only one line");371 assert!(lines.next().is_none(), "expected only one line");
372 Ok(res)372 Ok(res)
373}373}
374 374
375fn lenient_lines(input: &str) -> Vec<ExpandedAttribute> {375fn lenient_lines(input: &str) -> Vec<ExpandedAttribute<'_>> {
376 gix_attributes::parse(input.as_bytes())376 gix_attributes::parse(input.as_bytes())
377 .map(expand)377 .map(expand)
378 .filter_map(Result::ok)378 .filter_map(Result::ok)
379 .collect()379 .collect()
380}380}
381 381
382fn try_lines(input: &str) -> Result<Vec<ExpandedAttribute>, parse::Error> {382fn try_lines(input: &str) -> Result<Vec<ExpandedAttribute<'_>>, parse::Error> {
383 gix_attributes::parse(input.as_bytes()).map(expand).collect()383 gix_attributes::parse(input.as_bytes()).map(expand).collect()
384}384}
385 385
gix-config/tests/config/parse/section.rs+1−1
@@ -11,7 +11,7 @@ mod header { · 10 unmodified lines
11 11
12 use bstr::BStr;12 use bstr::BStr;
13 13
14 fn cow_section(name: &str) -> Option<Cow<BStr>> {14 fn cow_section(name: &str) -> Option<Cow<'_, BStr>> {
15 Some(Cow::Borrowed(name.into()))15 Some(Cow::Borrowed(name.into()))
16 }16 }
17 mod write_to {17 mod write_to {
gix-odb/src/store_impls/dynamic/load_index.rs+1−0
@@ -734,6 +734,7 @@ impl PartialEq<Self> for Either { · 733 unmodified lines
734 }734 }
735}735}
736 736
737#[allow(clippy::non_canonical_partial_ord_impl)]
737impl PartialOrd<Self> for Either {738impl PartialOrd<Self> for Either {
738 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {739 fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
739 Some(self.path().cmp(other.path()))740 Some(self.path().cmp(other.path()))
gix-ref/src/name.rs+1−0
@@ -221,6 +221,7 @@ impl<'a> convert::TryFrom<&'a str> for PartialName { · 220 unmodified lines
221 }221 }
222}222}
223 223
224#[allow(clippy::infallible_try_from)]
224impl<'a> convert::TryFrom<&'a FullName> for &'a PartialNameRef {225impl<'a> convert::TryFrom<&'a FullName> for &'a PartialNameRef {
225 type Error = Infallible;226 type Error = Infallible;
226 227
gix-refspec/src/spec.rs+1−0
@@ -69,6 +69,7 @@ mod impls { · 68 unmodified lines
69 }69 }
70 }70 }
71 71
72 #[allow(clippy::non_canonical_partial_ord_impl)]
72 impl PartialOrd for RefSpec {73 impl PartialOrd for RefSpec {
73 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {74 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
74 Some(self.to_ref().cmp(&other.to_ref()))75 Some(self.to_ref().cmp(&other.to_ref()))
gix/tests/gix-init.rs+1−1
@@ -268,7 +268,7 @@ mod with_overrides { · 267 unmodified lines
268 Ok(())268 Ok(())
269 }269 }
270 270
271 fn cow_bstr(s: &str) -> Cow<BStr> {271 fn cow_bstr(s: &str) -> Cow<'_, BStr> {
272 Cow::Borrowed(s.into())272 Cow::Borrowed(s.into())
273 }273 }
274}274}
gix/tests/gix/object/tree/diff.rs+1−1
@@ -879,7 +879,7 @@ mod track_rewrites { · 878 unmodified lines
879 }879 }
880}880}
881 881
882fn tree_named(repo: &gix::Repository, rev_spec: impl AsRef<str>) -> gix::Tree {882fn tree_named(repo: &gix::Repository, rev_spec: impl AsRef<str>) -> gix::Tree<'_> {
883 repo.rev_parse_single(rev_spec.as_ref())883 repo.rev_parse_single(rev_spec.as_ref())
884 .unwrap()884 .unwrap()
885 .object()885 .object()
tests/it/src/commands/blame_copy_royal.rs+2−6
@@ -161,14 +161,10 @@ git rm {src} · 160 unmodified lines
161"161"
162 ),162 ),
163 BlameScriptOperation::CommitFile(src, commit_id) => {163 BlameScriptOperation::CommitFile(src, commit_id) => {
164 write!(164 writeln!(f, r"# make file {src} contain content at commit {commit_id}")?;
165 f,
166 r"# make file {src} contain content at commit {commit_id}
167"
168 )?;
169 if let Some(pos) = src.rfind_byte(b'/') {165 if let Some(pos) = src.rfind_byte(b'/') {
170 let dirname = src[..pos].as_bstr();166 let dirname = src[..pos].as_bstr();
171 write!(f, "mkdir -p \"{dirname}\"\n")?;167 writeln!(f, "mkdir -p \"{dirname}\"")?;
172 }168 }
173 write!(169 write!(
174 f,170 f,