Skip to content

Commit

Permalink
Upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Saveau committed Nov 21, 2024
1 parent 7ed248f commit f9bb30e
Show file tree
Hide file tree
Showing 12 changed files with 291 additions and 329 deletions.
535 changes: 248 additions & 287 deletions Cargo.lock

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,45 +10,45 @@ categories = ["command-line-utilities", "development-tools", "development-tools:
license = "Apache-2.0"

[dependencies]
bon = "1.0.6"
bon = "3.0.2"
bytesize = "1.3.0"
cfg-if = "1.0.0"
clap = { version = "4.5.13", features = ["derive", "wrap_help"] }
clap = { version = "4.5.21", features = ["derive", "wrap_help"] }
clap-num = "1.1.1"
clap-verbosity-flag = { package = "clap-verbosity-flag2", version = "2.1.1" }
env_logger = { version = "0.11.5", default-features = false, features = ["auto-color"] }
error-stack = { version = "0.5.0", default-features = false, features = ["std"] }
io-adapters = "0.3.0"
itoa = "1.0.11"
io-adapters = "0.4.0"
itoa = "1.0.13"
log = { version = "0.4.22", features = ["release_max_level_info"] }
rand = { version = "0.8.5", default-features = false, features = ["std"] }
rand_distr = "0.4.3"
rand_xoshiro = "0.6.0"
sysexits = "0.8.1"
thiserror = "1.0.63"
sysexits = "0.8.5"
thiserror = "2.0.3"
thousands = "0.2.0"
tokio = { version = "1.39.2", features = ["rt"] }
tokio = { version = "1.41.1", features = ["rt"] }
tracing = { version = "0.1.40", features = ["log"], optional = true }
tracing-log = { version = "0.2.0", optional = true }
tracing-subscriber = { version = "0.3.18", optional = true }
tracing-tracy = { version = "0.11.1", features = ["flush-on-exit"], optional = true }
tracy-client = { version = "0.17.1", optional = true }
tracing-tracy = { version = "0.11.3", features = ["flush-on-exit"], optional = true }
tracy-client = { version = "0.17.4", optional = true }

[target.'cfg(unix)'.dependencies]
rustix = { version = "0.38.34", features = ["fs", "thread"] }
rustix = { version = "0.38.41", features = ["fs", "thread"] }

[dev-dependencies]
criterion = "0.5.1"
expect-test = "1.5.0"
more-asserts = "0.3.1"
rand = "0.8.5"
rstest = { version = "0.22.0", default-features = false }
supercilex-tests = "0.4.8"
tempfile = "3.11.0"
trycmd = "0.15.6"
rstest = { version = "0.23.0", default-features = false }
supercilex-tests = "0.4.11"
tempfile = "3.14.0"
trycmd = "0.15.8"

[build-dependencies]
itoa = "1.0.11"
itoa = "1.0.13"

[features]
trace = ["tracing", "dep:tracing-log", "dep:tracing-subscriber", "dep:tracing-tracy", "dep:tracy-client"]
Expand Down
4 changes: 2 additions & 2 deletions benches/generator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{io::sink, num::NonZeroU64, time::Duration};

use criterion::{
criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration,
Throughput,
AxisScale, BenchmarkId, Criterion, PlotConfiguration, Throughput, criterion_group,
criterion_main,
};
use ftzz::{Generator, NumFilesWithRatio};
use io_adapters::WriteExtension;
Expand Down
2 changes: 1 addition & 1 deletion src/core/files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use error_stack::{Report, Result, ResultExt};

use crate::{
core::file_contents::FileContentsGenerator,
utils::{with_dir_name, with_file_name, FastPathBuf},
utils::{FastPathBuf, with_dir_name, with_file_name},
};

pub struct GeneratorTaskParams<G: FileContentsGenerator> {
Expand Down
4 changes: 2 additions & 2 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rand::{distributions::Distribution, Rng};
use rand::{Rng, distributions::Distribution};
use rand_distr::Normal;
pub use scheduler::{run, GeneratorStats};
pub use scheduler::{GeneratorStats, run};
pub use tasks::{DynamicGenerator, GeneratorBytes, StaticGenerator};

mod file_contents;
Expand Down
2 changes: 1 addition & 1 deletion src/core/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use crate::{
truncatable_normal,
},
generator::Error,
utils::{with_dir_name, with_file_name, FastPathBuf},
utils::{FastPathBuf, with_dir_name, with_file_name},
};

#[derive(Debug, Copy, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/core/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
FileContentsGenerator, NoGeneratedFileContents, OnTheFlyGeneratedFileContents,
PreDefinedGeneratedFileContents,
},
files::{create_files_and_dirs, GeneratorTaskOutcome, GeneratorTaskParams},
files::{GeneratorTaskOutcome, GeneratorTaskParams, create_files_and_dirs},
sample_truncated,
},
utils::FastPathBuf,
Expand Down
12 changes: 6 additions & 6 deletions src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ use std::{
thread,
};

use bon::builder;
use bon::Builder;
use error_stack::{Report, Result, ResultExt};
use log::{log, Level};
use log::{Level, log};
use rand::SeedableRng;
use rand_xoshiro::Xoshiro256PlusPlus;
use thiserror::Error;
use thousands::Separable;

use crate::core::{
run, truncatable_normal, DynamicGenerator, GeneratorBytes, GeneratorStats, StaticGenerator,
DynamicGenerator, GeneratorBytes, GeneratorStats, StaticGenerator, run, truncatable_normal,
};

#[derive(Error, Debug)]
Expand Down Expand Up @@ -88,9 +88,9 @@ impl NumFilesWithRatio {
}
}

#[derive(Debug)]
#[builder]
#[derive(Debug, Builder)]
pub struct Generator {
#[builder(into)]
root_dir: PathBuf,
num_files_with_ratio: NumFilesWithRatio,
#[builder(default = false)]
Expand Down Expand Up @@ -357,7 +357,7 @@ fn run_generator(config: Configuration) -> Result<GeneratorStats, Error> {
let mut runtime = tokio::runtime::Builder::new_current_thread();
#[cfg(all(not(miri), target_os = "linux"))]
runtime.on_thread_start(|| {
use rustix::thread::{unshare, UnshareFlags};
use rustix::thread::{UnshareFlags, unshare};

let result = unshare(UnshareFlags::FILES);
#[cfg(debug_assertions)]
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use std::{
borrow::Cow,
io,
io::{stdout, Write},
io::{Write, stdout},
num::NonZeroU64,
path::PathBuf,
process::{ExitCode, Termination},
};

use clap::{builder::ArgPredicate, ArgAction, Args, Parser, ValueHint};
use clap::{ArgAction, Args, Parser, ValueHint, builder::ArgPredicate};
use clap_num::si_number;
use clap_verbosity_flag::Verbosity;
use error_stack::ResultExt;
Expand Down Expand Up @@ -269,7 +269,7 @@ fn ftzz(
help: _,
}: Ftzz,
) -> error_stack::Result<(), CliError> {
let mut stdout = stdout();
let stdout = stdout();
Generator::try_from(options)
.change_context(CliError::InvalidArgs)?
.generate(&mut stdout.write_adapter())
Expand Down
10 changes: 5 additions & 5 deletions src/utils/fast_path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{
ffi::OsStr,
fmt,
ops::{Deref, DerefMut},
path::{Path, PathBuf, MAIN_SEPARATOR},
path::{MAIN_SEPARATOR, Path, PathBuf},
};

/// A specialized [`PathBuf`][std::path::PathBuf] implementation that takes
Expand Down Expand Up @@ -199,7 +199,7 @@ mod unix {
buf: &'a mut FastPathBuf,
}

impl<'a> CStrFastPathBufGuard<'a> {
impl CStrFastPathBufGuard<'_> {
pub fn new(buf: &mut FastPathBuf) -> CStrFastPathBufGuard {
let FastPathBuf {
ref mut inner,
Expand All @@ -211,7 +211,7 @@ mod unix {
}
}

impl<'a> Deref for CStrFastPathBufGuard<'a> {
impl Deref for CStrFastPathBufGuard<'_> {
type Target = CStr;

fn deref(&self) -> &Self::Target {
Expand All @@ -231,13 +231,13 @@ mod unix {
}
}

impl<'a> AsRef<CStr> for CStrFastPathBufGuard<'a> {
impl AsRef<CStr> for CStrFastPathBufGuard<'_> {
fn as_ref(&self) -> &CStr {
self
}
}

impl<'a> Drop for CStrFastPathBufGuard<'a> {
impl Drop for CStrFastPathBufGuard<'_> {
fn drop(&mut self) {
let Self {
buf:
Expand Down
5 changes: 3 additions & 2 deletions src/utils/file_names.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::{mem::MaybeUninit, ptr, slice};

use itoa::Integer;

struct FileNameCache;

/// Specialized cache for file names that takes advantage of our monotonically
Expand Down Expand Up @@ -53,8 +55,7 @@ pub fn with_file_name<T>(i: u64, f: impl FnOnce(&str) -> T) -> T {
pub fn with_dir_name<T>(i: usize, f: impl FnOnce(&str) -> T) -> T {
const SUFFIX: &str = ".dir";
with_file_name(i.try_into().unwrap(), |s| {
const _: () = assert!(usize::BITS <= 128, "Unsupported usize width.");
let mut buf = [MaybeUninit::<u8>::uninit(); 39 + SUFFIX.len()]; // 39 to support u128
let mut buf = [MaybeUninit::<u8>::uninit(); usize::MAX_STR_LEN + SUFFIX.len()];

unsafe {
let buf_ptr = buf.as_mut_ptr().cast::<u8>();
Expand Down
8 changes: 4 additions & 4 deletions tests/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ use std::{
cmp::{max, min},
collections::VecDeque,
fmt::Write,
fs::{create_dir, DirEntry, File},
fs::{DirEntry, File, create_dir},
hash::{DefaultHasher, Hasher},
io,
io::{stdout, BufReader, Read},
io::{BufReader, Read, stdout},
num::NonZeroU64,
path::Path,
};
Expand All @@ -24,7 +24,7 @@ use crate::inspect::InspectableTempDir;
mod inspect {
use std::path::PathBuf;

use tempfile::{tempdir, TempDir};
use tempfile::{TempDir, tempdir};

pub struct InspectableTempDir {
pub path: PathBuf,
Expand Down Expand Up @@ -341,7 +341,7 @@ fn print_and_hash_dir(dir: &Path, output: &mut impl Write) {
} else if entry.metadata().unwrap().len() > 0 {
io::copy(
&mut File::open(entry.path()).unwrap(),
&mut hasher.write_adapter(),
&mut (&mut hasher).write_adapter(),
)
.unwrap();
}
Expand Down

0 comments on commit f9bb30e

Please sign in to comment.