Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -50,7 +50,7 @@ jobs:
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
Expand All @@ -76,7 +76,7 @@ jobs:
- stable
- nightly
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
Expand All @@ -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: |
Expand Down Expand Up @@ -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: |
Expand All @@ -153,7 +153,7 @@ jobs:
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
Expand All @@ -179,7 +179,7 @@ jobs:
- macos-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- uses: actions/cache@v4
with:
path: |
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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::<T>
edition = "2021"
authors = ["Nikolai Vazquez"]
license = "MIT OR Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):

Expand Down
10 changes: 5 additions & 5 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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"] }
Expand Down
2 changes: 1 addition & 1 deletion src/counter/any_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ impl AnyCounter {
&self,
duration: FineDuration,
bytes_format: BytesFormat,
) -> DisplayThroughput {
) -> DisplayThroughput<'_> {
DisplayThroughput {
counter: self,
picos: duration.picos as f64,
Expand Down
2 changes: 1 addition & 1 deletion src/entry/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 1 addition & 1 deletion src/entry/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down
2 changes: 1 addition & 1 deletion src/time/fine_duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
5 changes: 3 additions & 2 deletions src/time/timestamp/tsc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
10 changes: 5 additions & 5 deletions src/tree_painter.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Happy little trees.

use std::{io::Write, iter::repeat};
use std::io::Write;

use crate::{
alloc::{AllocOp, AllocTally},
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand All @@ -563,7 +563,7 @@ impl<T> TreeColumnData<T> {
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;
Expand Down
2 changes: 1 addition & 1 deletion src/util/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub(crate) fn slice_middle<T>(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]
Expand Down