Skip to content

Commit

Permalink
Fix more Clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
udoprog committed Feb 10, 2024
1 parent 034498e commit af17c2f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
- uses: dtolnay/rust-toolchain@1.76
with:
components: clippy
- run: cargo clippy --all-targets --features test -- -D warnings
- run: cargo clippy --workspace --exclude no-std-examples --all-targets --features test -- -D warnings

rustfmt:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions crates/tests/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
#[macro_use]
mod macros;

#[allow(unused_imports)]
pub use self::full::*;
mod full;

#[allow(unused_imports)]
pub use self::extra::*;
mod extra;

#[allow(unused_imports)]
pub use self::musli::*;
mod musli;
36 changes: 16 additions & 20 deletions crates/tools/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ use anyhow::{anyhow, bail, Context, Result};
use clap::{Parser, Subcommand};
use serde::{Deserialize, Serialize};

const REPO: &'static str = "https://raw.githubusercontent.com/udoprog/musli";
const REPO: &str = "https://raw.githubusercontent.com/udoprog/musli";

const COMMON: &'static [&'static str] = &["no-rt", "std", "alloc"];
const COMMON: &[&str] = &["no-rt", "std", "alloc"];

const REPORTS: &'static [Report] = &[
const REPORTS: &[Report] = &[
Report {
id: "full",
title: "Full features",
Expand Down Expand Up @@ -111,7 +111,7 @@ const REPORTS: &'static [Report] = &[
},
];

const LINKS: &'static [Link] = &[
const LINKS: &[Link] = &[
Link {
title: "`rkyv`",
href: "https://docs.rs/rkyv",
Expand All @@ -126,10 +126,9 @@ const LINKS: &'static [Link] = &[
},
];

const KINDS: &'static [(&'static str, &'static str)] =
&[("dec", "Decode a type"), ("enc", "Encode a type")];
const KINDS: &[(&str, &str)] = &[("dec", "Decode a type"), ("enc", "Encode a type")];

const GROUPS: &'static [Group] = &[
const GROUPS: &[Group] = &[
Group {
id: "primitives",
description: "which is a small object containing one of each primitive type and a string and a byte array.",
Expand Down Expand Up @@ -339,7 +338,7 @@ fn main() -> Result<()> {
writeln!(o)?;
}

for line in report.description.iter().copied() {
for &line in report.description.iter() {
writeln!(o, "{line}")?;
}

Expand Down Expand Up @@ -645,7 +644,7 @@ where

write!(o, "| {framework}{footnote} |")?;

for suite in columns.iter().copied() {
for &suite in columns.iter() {
let Some(mut set) = index
.remove(&(suite.to_owned(), framework.clone()))
.filter(|s| !s.samples.is_empty())
Expand Down Expand Up @@ -701,14 +700,14 @@ fn copy_svg(from: &Path, to: &Path) -> Result<()> {

for (index, line) in from.lines().enumerate() {
if index == 1 {
write!(
writeln!(
to,
"<rect width=\"100%\" height=\"100%\" fill=\"white\"></rect>\n"
"<rect width=\"100%\" height=\"100%\" fill=\"white\"></rect>"
)?;
}

let line = line?;
write!(to, "{}\n", line.trim())?;
writeln!(to, "{}", line.trim())?;
}

Ok(())
Expand Down Expand Up @@ -854,18 +853,15 @@ where
bad_features.push((a.target.name.clone(), Features::Unexpected(unexpected)));
}

match (
if let (Some(kind), Some(executable)) = (
a.target.kind.first().map(|s| s.as_str()),
a.executable.as_deref(),
) {
(Some(kind), Some(executable)) => {
if kind == "bin" && a.profile.test {
continue;
}

all.push((kind.to_owned(), a.target.name, PathBuf::from(executable)));
if kind == "bin" && a.profile.test {
continue;
}
_ => {}

all.push((kind.to_owned(), a.target.name, PathBuf::from(executable)));
}
}
_ => {}
Expand Down

0 comments on commit af17c2f

Please sign in to comment.