From bd4a754ba6a31d59129ff9937299f1602e97ae3c Mon Sep 17 00:00:00 2001 From: Michael Kefeder Date: Tue, 5 Sep 2023 19:08:32 +0200 Subject: [PATCH] apply clippy fixes and update dev-dependencies --- .github/workflows/rust.yml | 2 +- Cargo.toml | 3 +++ lcov2cobertura/src/lib.rs | 4 ++-- src/bin/cobertura_split.rs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0f46887..56507ef 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,7 +8,7 @@ on: env: CARGO_TERM_COLOR: always - RUSTFLAGS: "-F ambiguous-associated-items -F cenum-impl-drop-cast -F coherence-leak-check -F conflicting-repr-hints -F const-err -F const-evaluatable-unchecked -F deprecated-cfg-attr-crate-type-name -F deref-into-dyn-supertrait -A forbidden-lint-groups -F ill-formed-attribute-input -F illegal-floating-point-literal-pattern -F indirect-structural-match -F invalid-doc-attributes -F invalid-type-param-default -F late-bound-lifetime-arguments -F legacy-derive-helpers -F macro-expanded-macro-exports-accessed-by-absolute-paths -F missing-fragment-specifier -F nontrivial-structural-match -F order-dependent-trait-objects -F patterns-in-fns-without-body -F pointer-structural-match -F private-in-public -F proc-macro-back-compat -F proc-macro-derive-resolution-fallback -F pub-use-of-private-extern-crate -F semicolon-in-expressions-from-macros -F soft-unstable -F unaligned-references -F uninhabited-static -F unstable-name-collisions -F unsupported-calling-conventions -F where-clauses-object-safety -D warnings -D missing_docs -F rust-2021-compatibility -D rust-2018-idioms -D nonstandard-style" + RUSTFLAGS: "-F ambiguous-associated-items -F cenum-impl-drop-cast -F coherence-leak-check -F conflicting-repr-hints -F const-evaluatable-unchecked -F deprecated-cfg-attr-crate-type-name -F deref-into-dyn-supertrait -A forbidden-lint-groups -F ill-formed-attribute-input -F illegal-floating-point-literal-pattern -F indirect-structural-match -F invalid-doc-attributes -F invalid-type-param-default -F late-bound-lifetime-arguments -F legacy-derive-helpers -F macro-expanded-macro-exports-accessed-by-absolute-paths -F missing-fragment-specifier -F nontrivial-structural-match -F order-dependent-trait-objects -F patterns-in-fns-without-body -F pointer-structural-match -F private-in-public -F proc-macro-back-compat -F proc-macro-derive-resolution-fallback -F pub-use-of-private-extern-crate -F semicolon-in-expressions-from-macros -F soft-unstable -F uninhabited-static -F unstable-name-collisions -F unsupported-calling-conventions -F where-clauses-object-safety -D warnings -D missing_docs -F rust-2021-compatibility -D rust-2018-idioms -D nonstandard-style" CLIPPY_FLAGS: "-D clippy::expect_used -D clippy::panic -D clippy::unwrap_used -D clippy::unimplemented -F clippy::suspicious -F clippy::style -F clippy::complexity -F clippy::perf" jobs: diff --git a/Cargo.toml b/Cargo.toml index e3165f9..cda1b1f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,5 +17,8 @@ clap = { version = "4.0", features = ["derive"]} lcov = "0.8.1" lcov2cobertura = { path = "lcov2cobertura" } +[dev-dependencies] +quick-xml = "0.30.0" + [profile.release] strip = "symbols" diff --git a/lcov2cobertura/src/lib.rs b/lcov2cobertura/src/lib.rs index 66594bb..37a6afb 100644 --- a/lcov2cobertura/src/lib.rs +++ b/lcov2cobertura/src/lib.rs @@ -80,7 +80,7 @@ impl Package { impl CompSummary for Package { fn summary(&self) -> Summary { - let lines_total = self.classes.values().map(|c| c.lines.len() as usize).sum(); + let lines_total = self.classes.values().map(|c| c.lines.len()).sum(); let lines_covered = self.classes.values().map(|c| c.lines_covered).sum(); let branches_total = self .classes @@ -128,7 +128,7 @@ impl Class { impl CompSummary for Class { fn summary(&self) -> Summary { - let lines_total = self.lines.len() as usize; + let lines_total = self.lines.len(); let lines_covered = self.lines_covered; let branches_total = self.lines.values().map(|b| b.branches_total).sum::(); let branches_covered = self diff --git a/src/bin/cobertura_split.rs b/src/bin/cobertura_split.rs index e725896..f84c4f3 100644 --- a/src/bin/cobertura_split.rs +++ b/src/bin/cobertura_split.rs @@ -16,6 +16,6 @@ struct Args { fn main() -> anyhow::Result<()> { let args = Args::parse(); - lcov2xml::corbertura_xml_split(&args.filename)?; + lcov2xml::corbertura_xml_split(args.filename)?; Ok(()) }