diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..c7ecf5e --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: cargo + directory: / + schedule: + interval: weekly + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 826c8c8..97b95a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - run: rustup update stable --no-self-update - run: rustc -Vv - run: cargo fmt --all -- --check @@ -27,7 +27,7 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -50,7 +50,7 @@ jobs: - macos-latest - windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -76,7 +76,7 @@ jobs: - stable - nightly steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -94,7 +94,7 @@ jobs: if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -126,7 +126,7 @@ jobs: DIVAN_BYTES_COUNT: 1 DIVAN_CHARS_COUNT: 2 steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -153,7 +153,7 @@ jobs: - macos-latest - windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | @@ -179,7 +179,7 @@ jobs: - macos-latest - windows-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - uses: actions/cache@v4 with: path: | diff --git a/Cargo.toml b/Cargo.toml index f1b5377..962c21f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "divan" version = "0.1.21" -rust-version = "1.80.0" +rust-version = "1.91.0" # because of const TypeId::of:: edition = "2021" authors = ["Nikolai Vazquez"] license = "MIT OR Apache-2.0" diff --git a/README.md b/README.md index f8387d0..089cfd7 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ A guide is being worked on. In the meantime, see: ## Getting Started -Divan `0.1.21` requires Rust `1.80.0` or later. +Divan `0.1.21` requires Rust `1.91.0` or later. 1. Add the following to your project's [`Cargo.toml`](https://doc.rust-lang.org/cargo/reference/manifest.html): diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 028895a..df8424d 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -5,19 +5,19 @@ edition = "2021" authors = ["Nikolai Vazquez"] license = "MIT OR Apache-2.0" description = "Examples for Divan, a comfy benchmarking framework." -readme = "../README.md" +readme = "README.md" publish = false [dependencies] divan = { workspace = true } fastrand = "2" -image = { version = "0.24", optional = true } +image = { version = "0.25", optional = true } libc = "0.2.147" rayon = "1" # Search ordsearch = "0.2.5" -wyhash = "0.5" +wyhash = "0.6" # Hash blake3 = { version = "1.4", optional = true, features = ["rayon"] } @@ -29,13 +29,13 @@ seahash = { version = "4.1", optional = true } sha1 = { version = "0.10", optional = true } sha2 = { version = "0.10", optional = true } sha3 = { version = "0.10", optional = true } -twox-hash = { version = "1.6", optional = true } +twox-hash = { version = "2.1", optional = true } [target.'cfg(unix)'.dependencies] libc = { workspace = true } [target.'cfg(target_os = "macos")'.dependencies] -mach2 = "0.4" +mach2 = "0.5" [target.'cfg(any(windows, target_os = "linux", target_os = "android"))'.dependencies] winapi = { version = "0.3.9", features = ["processthreadsapi"] } diff --git a/src/counter/any_counter.rs b/src/counter/any_counter.rs index abc3fb9..9264162 100644 --- a/src/counter/any_counter.rs +++ b/src/counter/any_counter.rs @@ -66,7 +66,7 @@ impl AnyCounter { &self, duration: FineDuration, bytes_format: BytesFormat, - ) -> DisplayThroughput { + ) -> DisplayThroughput<'_> { DisplayThroughput { counter: self, picos: duration.picos as f64, diff --git a/src/entry/meta.rs b/src/entry/meta.rs index a910074..d1b3e0e 100644 --- a/src/entry/meta.rs +++ b/src/entry/meta.rs @@ -33,7 +33,7 @@ pub struct EntryLocation { impl EntryMeta { #[inline] - pub(crate) fn bench_options(&self) -> Option<&BenchOptions> { + pub(crate) fn bench_options(&self) -> Option<&BenchOptions<'_>> { self.bench_options.as_deref() } diff --git a/src/entry/tree.rs b/src/entry/tree.rs index bbefa9f..72ad219 100644 --- a/src/entry/tree.rs +++ b/src/entry/tree.rs @@ -373,7 +373,7 @@ impl<'a> EntryTree<'a> { } } - pub fn bench_options(&self) -> Option<&'a BenchOptions> { + pub fn bench_options(&self) -> Option<&'a BenchOptions<'_>> { self.meta()?.bench_options() } diff --git a/src/time/fine_duration.rs b/src/time/fine_duration.rs index cfa4cb8..878b501 100644 --- a/src/time/fine_duration.rs +++ b/src/time/fine_duration.rs @@ -65,7 +65,7 @@ impl fmt::Display for FineDuration { { match f.align() { None | Some(fmt::Alignment::Left) => { - str.extend(std::iter::repeat(f.fill()).take(fill_len)); + str.extend(std::iter::repeat_n(f.fill(), fill_len)); } _ => return Err(fmt::Error), } diff --git a/src/time/timestamp/tsc/mod.rs b/src/time/timestamp/tsc/mod.rs index 76838fc..0733a6f 100644 --- a/src/time/timestamp/tsc/mod.rs +++ b/src/time/timestamp/tsc/mod.rs @@ -34,8 +34,9 @@ impl TscTimestamp { target_arch = "x86", target_arch = "x86_64" ))] - return NonZeroU64::new(arch::frequency()?) - .ok_or(TscUnavailable::ZeroFrequency); + return arch::frequency().and_then(|v| { + NonZeroU64::new(v).ok_or(TscUnavailable::ZeroFrequency) + }); Err(TscUnavailable::Unimplemented) } diff --git a/src/tree_painter.rs b/src/tree_painter.rs index b271816..c3caf76 100644 --- a/src/tree_painter.rs +++ b/src/tree_painter.rs @@ -1,6 +1,6 @@ //! Happy little trees. -use std::{io::Write, iter::repeat}; +use std::io::Write; use crate::{ alloc::{AllocOp, AllocTally}, @@ -68,7 +68,7 @@ impl TreePainter { let max_span = self.max_name_span; let buf_len = buf.chars().count(); let pad_len = TREE_COL_BUF + max_span.saturating_sub(buf_len); - buf.extend(repeat(' ').take(pad_len)); + buf.extend(std::iter::repeat_n(' ', pad_len)); if buf_len > max_span { self.max_name_span = buf_len; @@ -157,7 +157,7 @@ impl TreePainter { let max_span = self.max_name_span; let buf_len = buf.chars().count(); let pad_len = TREE_COL_BUF + max_span.saturating_sub(buf_len); - buf.extend(repeat(' ').take(pad_len)); + buf.extend(std::iter::repeat_n(' ', pad_len)); if buf_len > max_span { self.max_name_span = buf_len; @@ -541,7 +541,7 @@ impl TreeColumnData<&str> { if let Some(rem_width) = column_widths[column].checked_sub(value_width) { - buf.extend(repeat(' ').take(rem_width)); + buf.extend(std::iter::repeat_n(' ', rem_width)); } else { column_widths[column] = value_width; } @@ -563,7 +563,7 @@ impl TreeColumnData { fn right_pad_buffer(buf: &mut String, max_span: &mut usize) { let buf_len = buf.chars().count(); let pad_len = TREE_COL_BUF + max_span.saturating_sub(buf_len); - buf.extend(repeat(' ').take(pad_len)); + buf.extend(std::iter::repeat_n(' ', pad_len)); if buf_len > *max_span { *max_span = buf_len; diff --git a/src/util/fmt.rs b/src/util/fmt.rs index 070b9df..d47c72d 100644 --- a/src/util/fmt.rs +++ b/src/util/fmt.rs @@ -94,7 +94,7 @@ impl fmt::Display for DisplayThroughput<'_> { { match f.align() { None | Some(fmt::Alignment::Left) => { - str.extend(std::iter::repeat(f.fill()).take(fill_len)); + str.extend(std::iter::repeat_n(f.fill(), fill_len)); } _ => return Err(fmt::Error), } diff --git a/src/util/mod.rs b/src/util/mod.rs index 8746781..fa0465b 100644 --- a/src/util/mod.rs +++ b/src/util/mod.rs @@ -85,7 +85,7 @@ pub(crate) fn slice_middle(slice: &[T]) -> &[T] { if len == 0 { slice - } else if len % 2 == 0 { + } else if len.is_multiple_of(2) { &slice[(len / 2) - 1..][..2] } else { &slice[len / 2..][..1]