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
Provenance
- Commit
dbd3e3c- Tree
251426b- Author
Thayne McCombs <astrothayne@gmail.com>- Committer
Thayne McCombs <astrothayne@gmail.com>- Parent
da731c4
15 files changed+129 added−121 removed
modified:.github/workflows/CICD.yml+1 added-3 removed
114 unmodified lines115 - 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"120 121 - name: Install cross122 if: matrix.job.use-cross123 uses: taiki-e/install-action@v2161 unmodified linesmodified:src/exec/job.rs+1 added-1 removed
1 use crate::config::Config;2 use crate::error::print_error;3-use crate::exit_codes::{merge_exitcodes, ExitCode};3+use crate::exit_codes::{ExitCode, merge_exitcodes};4 use crate::walk::WorkerResult;5 6 use super::CommandSet;7 57 unmodified linesmodified:src/exec/mod.rs+2 added-2 removed
5 unmodified lines6 use std::iter;7 use std::path::{Path, PathBuf};8 use std::process::Stdio;9 10-use anyhow::{bail, Result};10+use anyhow::{Result, bail};11 use argmax::Command;12 13 use crate::exec::command::OutputBuffer;14-use crate::exit_codes::{merge_exitcodes, ExitCode};14+use crate::exit_codes::{ExitCode, merge_exitcodes};15 use crate::fmt::{FormatTemplate, Token};16 17 use self::command::{execute_commands, handle_cmd_error};18 pub use self::job::{batch, job};455 unmodified linesmodified:src/filter/owner.rs+1 added-1 removed
1-use anyhow::{anyhow, Result};1+use anyhow::{Result, anyhow};2 use nix::unistd::{Group, User};3 use std::fs;4 5 #[derive(Clone, Copy, Debug, PartialEq, Eq)]135 unmodified linesmodified:src/filter/time.rs+51 added-31 removed
1-use jiff::{civil::DateTime, tz::TimeZone, Span, Timestamp, Zoned};1+use jiff::{Span, Timestamp, Zoned, civil::DateTime, tz::TimeZone};2 3 use std::time::{Duration, SystemTime, UNIX_EPOCH};4 5 /// Filter based on time ranges.107 unmodified lines113 assert!(TimeFilter::before("30sec").unwrap().applies_to(&t1m_ago));114 assert!(!TimeFilter::before("2min").unwrap().applies_to(&t1m_ago));115 116 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+ );127 128+ 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));134 135 let same_day = "2010-10-10";136 assert!(!TimeFilter::before(same_day).unwrap().applies_to(&ref_time));10 unmodified lines147 );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+ );161 162+ 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));168 169 let ref_timestamp = 1707723412u64; // Mon Feb 12 07:36:52 UTC 2024170 test_time.set(6 unmodified lines177 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 lines130 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 linesmodified:src/cli.rs+2 added-2 removed
2 unmodified lines3 use std::time::Duration;4 5 use anyhow::anyhow;6 use 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")]11 use clap_complete::Shell;12 use normpath::PathExt;929 unmodified linesmodified:src/exit_codes.rs+1 added-1 removed
1 use std::process;2 3 #[cfg(unix)]4-use nix::sys::signal::{raise, signal, SigHandler, Signal};4+use nix::sys::signal::{SigHandler, Signal, raise, signal};5 6 #[derive(Debug, Clone, Copy, PartialEq, Eq)]7 pub enum ExitCode {8 Success,86 unmodified linesmodified:src/main.rs+1 added-1 removed
16 unmodified lines17 use std::io::IsTerminal;18 use std::path::Path;19 use std::sync::Arc;20 21-use anyhow::{anyhow, bail, Context, Result};21+use anyhow::{Context, Result, anyhow, bail};22 use clap::{CommandFactory, Parser};23 use globset::GlobBuilder;24 use lscolors::LsColors;25 use regex::bytes::{Regex, RegexBuilder, RegexSetBuilder};466 unmodified linesmodified:src/output.rs+5 added-5 removed
13 unmodified lines14 15 // TODO: this function is performance critical and can probably be optimized16 pub 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 }24 25 if let Some(ref format) = config.format {26 print_entry_format(stdout, entry, config, format)?;149 unmodified linesmodified:src/regex_helper.rs+1 added-1 removed
1-use regex_syntax::hir::Hir;1 use regex_syntax::ParserBuilder;2+use regex_syntax::hir::Hir;3 4 /// Determine if a regex pattern contains a literal uppercase character.5 pub fn pattern_has_uppercase_char(pattern: &str) -> bool {6 let mut parser = ParserBuilder::new().utf8(false).build();99 unmodified linesmodified:src/walk.rs+51 added-50 removed
6 unmodified lines7 use std::sync::{Arc, Mutex, MutexGuard};8 use std::thread;9 use std::time::{Duration, Instant};10 11-use anyhow::{anyhow, Result};12-use crossbeam_channel::{bounded, Receiver, RecvTimeoutError, SendError, Sender};11+use anyhow::{Result, anyhow};12+use crossbeam_channel::{Receiver, RecvTimeoutError, SendError, Sender, bounded};13 use etcetera::BaseStrategy;14 use ignore::overrides::{Override, OverrideBuilder};15 use ignore::{WalkBuilder, WalkParallel, WalkState};16 use regex::bytes::Regex;1 unmodified line18 use crate::config::Config;19 use crate::dir_entry::DirEntry;20 use crate::error::print_error;21 use crate::exec;22-use crate::exit_codes::{merge_exitcodes, ExitCode};22+use crate::exit_codes::{ExitCode, merge_exitcodes};23 use crate::filesystem;24 use crate::output;25 26 /// The receiver thread can either be buffering results or directly streaming to the console.190 unmodified lines217 }218 }219 220 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 lines249 }250 251 /// 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 }259 260 if self.interrupt_flag.load(Ordering::Relaxed) {261 // Ignore any errors on flush, because we're about to exit anyway105 unmodified lines367 if config.read_fdignore {368 builder.add_custom_ignore_filename(".fdignore");369 }370 371- 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 lines446 let config = &self.config;447 let quit_flag = self.quit_flag.as_ref();448 449 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);458 459 Box::new(move |entry| {26 unmodified lines486 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 };500 500- 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 }506 507 // Check the name first, since it doesn't require metadata508 let entry_path = entry.path();31 unmodified lines540 }541 }542 543 // 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 }549 550 #[cfg(unix)]551 {30 unmodified lines582 583 // 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 }598 598- 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 }605 606 let send_result = tx.send(WorkerResult::Entry(entry));607 62 unmodified linesmodified:Cargo.lock+6 added-16 removed
1 # This file is automatically @generated by Cargo.2 # It is not intended for manual editing.3-version = 33+version = 44 5 [[package]]6 name = "aho-corasick"7 version = "1.1.3"280 unmodified lines288 "etcetera",289 "faccess",290 "filetime",291 "globset",292- "home",292 "ignore",293 "jiff",294 "libc",295 "lscolors",57 unmodified lines353 checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"354 355 [[package]]356 name = "home"358-version = "0.5.9"357+version = "0.5.11"358 source = "registry+https://github.com/rust-lang/crates.io-index"360-checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"359+checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"360 dependencies = [362- "windows-sys 0.52.0",361+ "windows-sys 0.59.0",362 ]363 364 [[package]]365 name = "ignore"373 unmodified lines739 ]740 741 [[package]]742 name = "unicode-ident"744-version = "1.0.19"743+version = "1.0.20"744 source = "registry+https://github.com/rust-lang/crates.io-index"746-checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"745+checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06"746 747 [[package]]748 name = "utf8parse"749 version = "0.2.2"57 unmodified lines807 checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"808 809 [[package]]810 name = "windows-sys"812-version = "0.52.0"813-source = "registry+https://github.com/rust-lang/crates.io-index"814-checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"815-dependencies = [816- "windows-targets 0.52.6",817-]818-819-[[package]]820-name = "windows-sys"811 version = "0.59.0"812 source = "registry+https://github.com/rust-lang/crates.io-index"813 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"814 dependencies = [155 unmodified linesmodified:Cargo.toml+3 added-6 removed
15 unmodified lines16 name = "fd-find"17 readme = "README.md"18 repository = "https://github.com/sharkdp/fd"19 version = "10.3.0"20-edition= "2021"21-rust-version = "1.77.2"20+edition= "2024"21+rust-version = "1.90.0"22 23 [badges.appveyor]24 repository = "sharkdp/fd"25 8 unmodified lines34 aho-corasick = "1.1"35 nu-ansi-term = "0.50"36 argmax = "0.4.0"37 ignore = "0.4.24"38-regex = "1.11.2"38+regex = "1.12.2"39 regex-syntax = "0.8"40 ctrlc = "3.4"41 globset = "0.4"42 anyhow = "1.0"2 unmodified lines45 crossbeam-channel = "0.5.15"46 clap_complete = {version = "4.5.58", optional = true}47 faccess = "0.2.4"48 jiff = "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 dependency51-home = "=0.5.9"49 50 [dependencies.clap]51 version = "4.5.48"52 features = ["suggestions", "color", "wrap_help", "cargo", "derive"]53 unmodified linesmodified:CHANGELOG.md+2 added
9 unmodified lines10 11 12 ## Changes13 14+- Minimum required rust version has been increased to 1.90.0. Notably, this means dropping fully support for intel Mac and Windows 7.15 16+17 ## Other18 19 # 10.3.020 816 unmodified lines