diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1ff92d7..4404ba0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: matrix: rust: - stable - - 1.43.0 + - 1.74.0 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -37,7 +37,7 @@ jobs: matrix: rust: - stable - - 1.43.0 + - 1.74.0 steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 @@ -66,22 +66,34 @@ jobs: fail-fast: false matrix: job: + # Ubuntu 22.04 + - { os: ubuntu-22.04 , target: x86_64-unknown-linux-gnu , use-cross: false } + - { os: ubuntu-22.04 , target: x86_64-unknown-linux-musl , use-cross: true } + - { os: ubuntu-22.04 , target: arm-unknown-linux-gnueabihf , use-cross: true } + - { os: ubuntu-22.04 , target: aarch64-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-22.04 , target: i586-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-22.04 , target: i686-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-22.04 , target: i686-unknown-linux-musl , use-cross: true } # Ubuntu 20.04 - - { os: ubuntu-20.04 , target: x86_64-unknown-linux-gnu , use-cross: false } - - { os: ubuntu-20.04 , target: x86_64-unknown-linux-musl , use-cross: true } - - { os: ubuntu-20.04 , target: arm-unknown-linux-gnueabihf , use-cross: true } - - { os: ubuntu-20.04 , target: aarch64-unknown-linux-gnu , use-cross: true } - - { os: ubuntu-20.04 , target: i586-unknown-linux-gnu , use-cross: true } - - { os: ubuntu-20.04 , target: i686-unknown-linux-gnu , use-cross: true } - - { os: ubuntu-20.04 , target: i686-unknown-linux-musl , use-cross: true } - # Older Ubuntu versions - - { os: ubuntu-18.04 , target: x86_64-unknown-linux-gnu , use-cross: false } - # MacOS - - { os: macos-10.15 , target: x86_64-apple-darwin , use-cross: false } - # Windows - - { os: windows-2019 , target: i686-pc-windows-msvc , use-cross: false } - - { os: windows-2019 , target: x86_64-pc-windows-gnu , use-cross: false } - - { os: windows-2019 , target: x86_64-pc-windows-msvc , use-cross: false } + - { os: ubuntu-20.04 , target: x86_64-unknown-linux-gnu , use-cross: false } + - { os: ubuntu-20.04 , target: x86_64-unknown-linux-musl , use-cross: true } + - { os: ubuntu-20.04 , target: arm-unknown-linux-gnueabihf , use-cross: true } + - { os: ubuntu-20.04 , target: aarch64-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-20.04 , target: i586-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-20.04 , target: i686-unknown-linux-gnu , use-cross: true } + - { os: ubuntu-20.04 , target: i686-unknown-linux-musl , use-cross: true } + # MacOS 14 + - { os: macos-14 , target: aarch64-apple-darwin , use-cross: false } + # Macos 13 + - { os: macos-13 , target: x86_64-apple-darwin , use-cross: false } + # Windows 2022 + - { os: windows-2022 , target: i686-pc-windows-msvc , use-cross: false } + - { os: windows-2022 , target: x86_64-pc-windows-gnu , use-cross: false } + - { os: windows-2022 , target: x86_64-pc-windows-msvc , use-cross: false } + # Windows 2019 + - { os: windows-2019 , target: i686-pc-windows-msvc , use-cross: false } + - { os: windows-2019 , target: x86_64-pc-windows-gnu , use-cross: false } + - { os: windows-2019 , target: x86_64-pc-windows-msvc , use-cross: false } runs-on: ${{ matrix.job.os }} steps: @@ -125,7 +137,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.43.0 + toolchain: 1.74.0 override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 @@ -142,7 +154,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.43.0 + toolchain: 1.74.0 override: true - run: rustup component add clippy - uses: actions-rs/cargo@v1 diff --git a/src/collector.rs b/src/collector.rs index 8707eb7..4b4c543 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -2,6 +2,7 @@ use std::borrow::Cow; use std::ffi::{OsStr, OsString}; +use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; @@ -219,12 +220,13 @@ impl Collector for EnvironmentVariables { let mut result = String::new(); for var in &self.list { - let value = std::env::var_os(&var).map(|value| value.to_string_lossy().into_owned()); + let value = std::env::var_os(var).map(|value| value.to_string_lossy().into_owned()); let value: Option = value.map(|v| shell_escape::escape(Cow::Borrowed(&v)).into()); - result += &format!( - "{}={}\n", + let _ = writeln!( + result, + "{}={}", var.to_string_lossy(), value.unwrap_or_else(|| "".into()) ); diff --git a/src/collector/directory_entries.rs b/src/collector/directory_entries.rs index bd6ec6b..f96f37e 100644 --- a/src/collector/directory_entries.rs +++ b/src/collector/directory_entries.rs @@ -1,3 +1,4 @@ +use std::fmt::Write; use std::fs::{self, DirEntry}; use std::io::ErrorKind; use std::path::{Path, PathBuf}; @@ -80,7 +81,7 @@ fn dir_entry_to_report_entry(dir_entry: DirEntry) -> String { if let Ok(metadata) = dir_entry.metadata() { if metadata.is_file() { - text.push_str(&format!(", {} bytes", metadata.len())); + let _ = write!(text, ", {} bytes", metadata.len()); } else if metadata.is_dir() { text.push(std::path::MAIN_SEPARATOR); }