Skip to content
Myr

build(msrv): Update msrv to 1.90.0

Before adoption: this commit came in with the history the project adopted, so no landing records it.

And upgrade to 2024 edition

authored by Thayne McCombs · committed by Thayne McCombs · parent da731c4 · Browse files · 15 files+129 added−121 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

15 files+129 added−121 removed

  • other:+129 added−121 removed

15 files+129 added−121 removed

modified:.github/workflows/CICD.yml+1 added-3 removed
114 unmodified lines
115 - name: Install Rust toolchain116 uses: dtolnay/rust-toolchain@stable117 with:118 targets: ${{ matrix.job.target }}119 # On windows, for now build with 1.77.2, so that it works on windows 7.120 # When we update the MSRV again, we'll need to revisit this, and probably drop support for Win7121 toolchain: "${{ contains(matrix.job.target, 'windows-') && '1.77.2' || 'stable' }}"119 toolchain: "stable"120121 - name: Install cross122 if: matrix.job.use-cross123 uses: taiki-e/install-action@v2
161 unmodified lines
modified:src/exec/job.rs+1 added-1 removed
1use crate::config::Config;2use crate::error::print_error;3use crate::exit_codes::{merge_exitcodes, ExitCode};3use crate::exit_codes::{ExitCode, merge_exitcodes};4use crate::walk::WorkerResult;56use super::CommandSet;7
57 unmodified lines
modified:src/exec/mod.rs+2 added-2 removed
5 unmodified lines
6use std::iter;7use std::path::{Path, PathBuf};8use std::process::Stdio;910use anyhow::{bail, Result};10use anyhow::{Result, bail};11use argmax::Command;1213use crate::exec::command::OutputBuffer;14use crate::exit_codes::{merge_exitcodes, ExitCode};14use crate::exit_codes::{ExitCode, merge_exitcodes};15use crate::fmt::{FormatTemplate, Token};1617use self::command::{execute_commands, handle_cmd_error};18pub use self::job::{batch, job};
455 unmodified lines
modified:src/filter/owner.rs+1 added-1 removed
1use anyhow::{anyhow, Result};1use anyhow::{Result, anyhow};2use nix::unistd::{Group, User};3use std::fs;45#[derive(Clone, Copy, Debug, PartialEq, Eq)]
135 unmodified lines
modified:src/filter/time.rs+51 added-31 removed
1use jiff::{civil::DateTime, tz::TimeZone, Span, Timestamp, Zoned};1use jiff::{Span, Timestamp, Zoned, civil::DateTime, tz::TimeZone};23use std::time::{Duration, SystemTime, UNIX_EPOCH};45/// Filter based on time ranges.
107 unmodified lines
113 assert!(TimeFilter::before("30sec").unwrap().applies_to(&t1m_ago));114 assert!(!TimeFilter::before("2min").unwrap().applies_to(&t1m_ago));115116 let t10s_before = "2010-10-10 10:10:00";117 assert!(!TimeFilter::before(t10s_before)118 .unwrap()119 .applies_to(&ref_time));120 assert!(TimeFilter::before(t10s_before)121 .unwrap()122 .applies_to(&t1m_ago));117 assert!(118 !TimeFilter::before(t10s_before)119 .unwrap()120 .applies_to(&ref_time)121 );122 assert!(123 TimeFilter::before(t10s_before)124 .unwrap()125 .applies_to(&t1m_ago)126 );127128 assert!(124 assert!(TimeFilter::after(t10s_before)125 .unwrap()126 .applies_to(&ref_time));129 TimeFilter::after(t10s_before)130 .unwrap()131 .applies_to(&ref_time)132 );133 assert!(!TimeFilter::after(t10s_before).unwrap().applies_to(&t1m_ago));134135 let same_day = "2010-10-10";136 assert!(!TimeFilter::before(same_day).unwrap().applies_to(&ref_time));
10 unmodified lines
147 );148 ref_time = test_time.timestamp();149 let t1m_ago = ref_time - Duration::from_secs(60);150 let t10s_before = "2010-10-10T10:10:00+00:00";145 assert!(!TimeFilter::before(t10s_before)146 .unwrap()147 .applies_to(&ref_time));148 assert!(TimeFilter::before(t10s_before)149 .unwrap()150 .applies_to(&t1m_ago));151 assert!(152 !TimeFilter::before(t10s_before)153 .unwrap()154 .applies_to(&ref_time)155 );156 assert!(157 TimeFilter::before(t10s_before)158 .unwrap()159 .applies_to(&t1m_ago)160 );161162 assert!(152 assert!(TimeFilter::after(t10s_before)153 .unwrap()154 .applies_to(&ref_time));163 TimeFilter::after(t10s_before)164 .unwrap()165 .applies_to(&ref_time)166 );167 assert!(!TimeFilter::after(t10s_before).unwrap().applies_to(&t1m_ago));168169 let ref_timestamp = 1707723412u64; // Mon Feb 12 07:36:52 UTC 2024170 test_time.set(
6 unmodified lines
177 let t1m_ago = ref_time - Duration::from_secs(60);178 let t1s_later = ref_time + Duration::from_secs(1);179 // Timestamp only supported via '@' prefix180 assert!(TimeFilter::before(&ref_timestamp.to_string()).is_none());169 assert!(TimeFilter::before(&format!("@{ref_timestamp}"))170 .unwrap()171 .applies_to(&t1m_ago));172 assert!(!TimeFilter::before(&format!("@{ref_timestamp}"))173 .unwrap()174 .applies_to(&t1s_later));175 assert!(!TimeFilter::after(&format!("@{ref_timestamp}"))176 .unwrap()177 .applies_to(&t1m_ago));178 assert!(TimeFilter::after(&format!("@{ref_timestamp}"))179 .unwrap()180 .applies_to(&t1s_later));181 assert!(182 TimeFilter::before(&format!("@{ref_timestamp}"))183 .unwrap()184 .applies_to(&t1m_ago)185 );186 assert!(187 !TimeFilter::before(&format!("@{ref_timestamp}"))188 .unwrap()189 .applies_to(&t1s_later)190 );191 assert!(192 !TimeFilter::after(&format!("@{ref_timestamp}"))193 .unwrap()194 .applies_to(&t1m_ago)195 );196 assert!(197 TimeFilter::after(&format!("@{ref_timestamp}"))198 .unwrap()199 .applies_to(&t1s_later)200 );201 }202}
modified:src/fmt/mod.rs+1 added-1 removed
129 unmodified lines
130 Parent => s.push(Self::replace_separator(&dirname(path), path_separator)),131 Placeholder => {132 s.push(Self::replace_separator(path.as_ref(), path_separator))133 }134 Text(ref string) => s.push(string),134 Text(string) => s.push(string),135 }136 }137 s138 }
143 unmodified lines
modified:src/cli.rs+2 added-2 removed
2 unmodified lines
3use std::time::Duration;45use anyhow::anyhow;6use clap::{7 error::ErrorKind, value_parser, Arg, ArgAction, ArgGroup, ArgMatches, Command, Parser,8 ValueEnum,7 Arg, ArgAction, ArgGroup, ArgMatches, Command, Parser, ValueEnum, error::ErrorKind,8 value_parser,9};10#[cfg(feature = "completions")]11use clap_complete::Shell;12use normpath::PathExt;
929 unmodified lines
modified:src/exit_codes.rs+1 added-1 removed
1use std::process;23#[cfg(unix)]4use nix::sys::signal::{raise, signal, SigHandler, Signal};4use nix::sys::signal::{SigHandler, Signal, raise, signal};56#[derive(Debug, Clone, Copy, PartialEq, Eq)]7pub enum ExitCode {8 Success,
86 unmodified lines
modified:src/main.rs+1 added-1 removed
16 unmodified lines
17use std::io::IsTerminal;18use std::path::Path;19use std::sync::Arc;2021use anyhow::{anyhow, bail, Context, Result};21use anyhow::{Context, Result, anyhow, bail};22use clap::{CommandFactory, Parser};23use globset::GlobBuilder;24use lscolors::LsColors;25use regex::bytes::{Regex, RegexBuilder, RegexSetBuilder};
466 unmodified lines
modified:src/output.rs+5 added-5 removed
13 unmodified lines
1415// TODO: this function is performance critical and can probably be optimized16pub fn print_entry<W: Write>(stdout: &mut W, entry: &DirEntry, config: &Config) -> io::Result<()> {17 let mut has_hyperlink = false;18 if config.hyperlink {19 if let Some(url) = PathUrl::new(entry.path()) {20 write!(stdout, "\x1B]8;;{url}\x1B\\")?;21 has_hyperlink = true;22 }18 if config.hyperlink19 && let Some(url) = PathUrl::new(entry.path())20 {21 write!(stdout, "\x1B]8;;{url}\x1B\\")?;22 has_hyperlink = true;23 }2425 if let Some(ref format) = config.format {26 print_entry_format(stdout, entry, config, format)?;
149 unmodified lines
modified:src/regex_helper.rs+1 added-1 removed
1use regex_syntax::hir::Hir;1use regex_syntax::ParserBuilder;2use regex_syntax::hir::Hir;34/// Determine if a regex pattern contains a literal uppercase character.5pub fn pattern_has_uppercase_char(pattern: &str) -> bool {6 let mut parser = ParserBuilder::new().utf8(false).build();
99 unmodified lines
modified:src/walk.rs+51 added-50 removed
6 unmodified lines
7use std::sync::{Arc, Mutex, MutexGuard};8use std::thread;9use std::time::{Duration, Instant};1011use anyhow::{anyhow, Result};12use crossbeam_channel::{bounded, Receiver, RecvTimeoutError, SendError, Sender};11use anyhow::{Result, anyhow};12use crossbeam_channel::{Receiver, RecvTimeoutError, SendError, Sender, bounded};13use etcetera::BaseStrategy;14use ignore::overrides::{Override, OverrideBuilder};15use ignore::{WalkBuilder, WalkParallel, WalkState};16use regex::bytes::Regex;
1 unmodified line
18use crate::config::Config;19use crate::dir_entry::DirEntry;20use crate::error::print_error;21use crate::exec;22use crate::exit_codes::{merge_exitcodes, ExitCode};22use crate::exit_codes::{ExitCode, merge_exitcodes};23use crate::filesystem;24use crate::output;2526/// The receiver thread can either be buffering results or directly streaming to the console.
190 unmodified lines
217 }218 }219220 self.num_results += 1;221 if let Some(max_results) = self.config.max_results {222 if self.num_results >= max_results {223 return self.stop();224 }221 if let Some(max_results) = self.config.max_results222 && self.num_results >= max_results223 {224 return self.stop();225 }226 }227 WorkerResult::Error(err) => {228 if self.config.show_filesystem_errors {
20 unmodified lines
249 }250251 /// Output a path.252 fn print(&mut self, entry: &DirEntry) -> Result<(), ExitCode> {253 if let Err(e) = output::print_entry(&mut self.stdout, entry, self.config) {254 if e.kind() != ::std::io::ErrorKind::BrokenPipe {255 print_error(format!("Could not write to output: {e}"));256 return Err(ExitCode::GeneralError);257 }253 if let Err(e) = output::print_entry(&mut self.stdout, entry, self.config)254 && e.kind() != ::std::io::ErrorKind::BrokenPipe255 {256 print_error(format!("Could not write to output: {e}"));257 return Err(ExitCode::GeneralError);258 }259260 if self.interrupt_flag.load(Ordering::Relaxed) {261 // Ignore any errors on flush, because we're about to exit anyway
105 unmodified lines
367 if config.read_fdignore {368 builder.add_custom_ignore_filename(".fdignore");369 }370371 if config.read_global_ignore {372 if let Ok(basedirs) = etcetera::choose_base_strategy() {373 let global_ignore_file = basedirs.config_dir().join("fd").join("ignore");374 if global_ignore_file.is_file() {375 let result = builder.add_ignore(global_ignore_file);376 match result {377 Some(ignore::Error::Partial(_)) => (),378 Some(err) => {379 print_error(format!("Malformed pattern in global ignore file. {err}."));380 }381 None => (),371 if config.read_global_ignore372 && let Ok(basedirs) = etcetera::choose_base_strategy()373 {374 let global_ignore_file = basedirs.config_dir().join("fd").join("ignore");375 if global_ignore_file.is_file() {376 let result = builder.add_ignore(global_ignore_file);377 match result {378 Some(ignore::Error::Partial(_)) => (),379 Some(err) => {380 print_error(format!("Malformed pattern in global ignore file. {err}."));381 }382 None => (),383 }384 }385 }386
59 unmodified lines
446 let config = &self.config;447 let quit_flag = self.quit_flag.as_ref();448449 let mut limit = 0x100;450 if let Some(cmd) = &config.command {451 if !cmd.in_batch_mode() && config.threads > 1 {452 // Evenly distribute work between multiple receivers453 limit = 1;454 }450 if let Some(cmd) = &config.command451 && !cmd.in_batch_mode()452 && config.threads > 1453 {454 // Evenly distribute work between multiple receivers455 limit = 1;456 }457 let mut tx = BatchSender::new(tx.clone(), limit);458459 Box::new(move |entry| {
26 unmodified lines
486 err: inner_err,487 })) {488 Ok(_) => WalkState::Continue,489 Err(_) => WalkState::Quit,489 }490 };491 }492 },493 Err(err) => {494 return match tx.send(WorkerResult::Error(err)) {495 Ok(_) => WalkState::Continue,496 Err(_) => WalkState::Quit,496 }497 };498 }499 };500500 if let Some(min_depth) = config.min_depth {501 if entry.depth().map_or(true, |d| d < min_depth) {502 return WalkState::Continue;503 }501 if let Some(min_depth) = config.min_depth502 && entry.depth().is_none_or(|d| d < min_depth)503 {504 return WalkState::Continue;505 }506507 // Check the name first, since it doesn't require metadata508 let entry_path = entry.path();
31 unmodified lines
540 }541 }542543 // Filter out unwanted file types.543 if let Some(ref file_types) = config.file_types {544 if file_types.should_ignore(&entry) {545 return WalkState::Continue;546 }544 if let Some(ref file_types) = config.file_types545 && file_types.should_ignore(&entry)546 {547 return WalkState::Continue;548 }549550 #[cfg(unix)]551 {
30 unmodified lines
582583 // Filter out unwanted modification times584 if !config.time_constraints.is_empty() {585 let mut matched = false;585 if let Some(metadata) = entry.metadata() {586 if let Ok(modified) = metadata.modified() {587 matched = config588 .time_constraints589 .iter()590 .all(|tf| tf.applies_to(&modified));591 }586 if let Some(metadata) = entry.metadata()587 && let Ok(modified) = metadata.modified()588 {589 matched = config590 .time_constraints591 .iter()592 .all(|tf| tf.applies_to(&modified));593 }594 if !matched {595 return WalkState::Continue;596 }597 }598598 if config.is_printing() {599 if let Some(ls_colors) = &config.ls_colors {600 // Compute colors in parallel601 entry.style(ls_colors);602 }599 if config.is_printing()600 && let Some(ls_colors) = &config.ls_colors601 {602 // Compute colors in parallel603 entry.style(ls_colors);604 }605606 let send_result = tx.send(WorkerResult::Entry(entry));607
62 unmodified lines
modified:Cargo.lock+6 added-16 removed
1# This file is automatically @generated by Cargo.2# It is not intended for manual editing.3version = 33version = 445[[package]]6name = "aho-corasick"7version = "1.1.3"
280 unmodified lines
288 "etcetera",289 "faccess",290 "filetime",291 "globset",292 "home",292 "ignore",293 "jiff",294 "libc",295 "lscolors",
57 unmodified lines
353checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"354355[[package]]356name = "home"358version = "0.5.9"357version = "0.5.11"358source = "registry+https://github.com/rust-lang/crates.io-index"360checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"359checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"360dependencies = [362 "windows-sys 0.52.0",361 "windows-sys 0.59.0",362]363364[[package]]365name = "ignore"
373 unmodified lines
739]740741[[package]]742name = "unicode-ident"744version = "1.0.19"743version = "1.0.20"744source = "registry+https://github.com/rust-lang/crates.io-index"746checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"745checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06"746747[[package]]748name = "utf8parse"749version = "0.2.2"
57 unmodified lines
807checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"808809[[package]]810name = "windows-sys"812version = "0.52.0"813source = "registry+https://github.com/rust-lang/crates.io-index"814checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"815dependencies = [816 "windows-targets 0.52.6",817]818819[[package]]820name = "windows-sys"811version = "0.59.0"812source = "registry+https://github.com/rust-lang/crates.io-index"813checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"814dependencies = [
155 unmodified lines
modified:Cargo.toml+3 added-6 removed
15 unmodified lines
16name = "fd-find"17readme = "README.md"18repository = "https://github.com/sharkdp/fd"19version = "10.3.0"20edition= "2021"21rust-version = "1.77.2"20edition= "2024"21rust-version = "1.90.0"2223[badges.appveyor]24repository = "sharkdp/fd"25
8 unmodified lines
34aho-corasick = "1.1"35nu-ansi-term = "0.50"36argmax = "0.4.0"37ignore = "0.4.24"38regex = "1.11.2"38regex = "1.12.2"39regex-syntax = "0.8"40ctrlc = "3.4"41globset = "0.4"42anyhow = "1.0"
2 unmodified lines
45crossbeam-channel = "0.5.15"46clap_complete = {version = "4.5.58", optional = true}47faccess = "0.2.4"48jiff = "0.2.14"49# For now, pin the `home` crate to less than 0.5.11, to ensure it works on older versions of rust50# TODO: when we upgrade past rust 1.85, remove this dependency51home = "=0.5.9"4950[dependencies.clap]51version = "4.5.48"52features = ["suggestions", "color", "wrap_help", "cargo", "derive"]
53 unmodified lines
modified:CHANGELOG.md+2 added
9 unmodified lines
101112## Changes1314- Minimum required rust version has been increased to 1.90.0. Notably, this means dropping fully support for intel Mac and Windows 7.151617## Other1819# 10.3.020
816 unmodified lines