Skip to content
Myr

Merge pull request #1333 from tmccombs/rust-170

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

Rust 1.70 upgrade

authored by Thayne McCombs · committed by GitHub · parents d6e9cbf, 740edeb · Browse files · 6 files+17 added−39 removed
This commit

State

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

Diff stats

6 files+17 added−39 removed

  • other:+17 added−39 removed

6 files+17 added−39 removed

modified:src/exec/mod.rs+6 added-5 removed
7 unmodified lines
8use std::io;9use std::iter;10use std::path::{Component, Path, PathBuf, Prefix};11use std::process::Stdio;12use std::sync::Mutex;12use std::sync::{Mutex, OnceLock};1314use anyhow::{bail, Result};15use argmax::Command;16use once_cell::sync::Lazy;16use regex::Regex;1718use crate::exit_codes::{merge_exitcodes, ExitCode};19
209 unmodified lines
229 where230 I: IntoIterator<Item = S>,231 S: AsRef<str>,232 {234 static PLACEHOLDER_PATTERN: Lazy<Regex> =235 Lazy::new(|| Regex::new(r"\{(/?\.?|//)\}").unwrap());233 static PLACEHOLDER_PATTERN: OnceLock<Regex> = OnceLock::new();234235 let mut args = Vec::new();236 let mut has_placeholder = false;237
2 unmodified lines
240241 let mut tokens = Vec::new();242 let mut start = 0;243244 let pattern =245 PLACEHOLDER_PATTERN.get_or_init(|| Regex::new(r"\{(/?\.?|//)\}").unwrap());246246 for placeholder in PLACEHOLDER_PATTERN.find_iter(arg) {247 for placeholder in pattern.find_iter(arg) {248 // Leading text before the placeholder.249 if placeholder.start() > start {250 tokens.push(Token::Text(arg[start..placeholder.start()].to_owned()));251 }
346 unmodified lines
modified:src/filter/size.rs+7 added-5 removed
1use std::sync::OnceLock;23use anyhow::anyhow;2use once_cell::sync::Lazy;4use regex::Regex;55static SIZE_CAPTURES: Lazy<Regex> =6 Lazy::new(|| Regex::new(r"(?i)^([+-]?)(\d+)(b|[kmgt]i?b?)$").unwrap());6static SIZE_CAPTURES: OnceLock<Regex> = OnceLock::new();78#[derive(Clone, Copy, Debug, PartialEq, Eq)]9pub enum SizeFilter {10 Max(u64),
19 unmodified lines
30 .ok_or_else(|| anyhow!("'{}' is not a valid size constraint. See 'fd --help'.", s))31 }3233 fn parse_opt(s: &str) -> Option<Self> {34 let pattern =35 SIZE_CAPTURES.get_or_init(|| Regex::new(r"(?i)^([+-]?)(\d+)(b|[kmgt]i?b?)$").unwrap());34 if !SIZE_CAPTURES.is_match(s) {36 if !pattern.is_match(s) {37 return None;38 }3938 let captures = SIZE_CAPTURES.captures(s)?;40 let captures = pattern.captures(s)?;41 let limit_kind = captures.get(1).map_or("+", |m| m.as_str());42 let quantity = captures43 .get(2)44 .and_then(|v| v.as_str().parse::<u64>().ok())?;
175 unmodified lines
modified:src/dir_entry.rs+1 added-2 removed
1use std::cell::OnceCell;2use std::ffi::OsString;3use std::fs::{FileType, Metadata};4use std::path::{Path, PathBuf};56use lscolors::{Colorable, LsColors, Style};77use once_cell::unsync::OnceCell;88use crate::config::Config;9use crate::filesystem::strip_current_dir;1011enum DirEntryInner {
142 unmodified lines
modified:src/main.rs+2 added-2 removed
10 unmodified lines
11mod regex_helper;12mod walk;1314use std::env;15use std::io::IsTerminal;16use std::path::Path;17use std::sync::Arc;18use std::time;1920use anyhow::{anyhow, bail, Context, Result};20use atty::Stream;21use clap::{CommandFactory, Parser};22use globset::GlobBuilder;23use lscolors::LsColors;24use regex::bytes::{Regex, RegexBuilder, RegexSetBuilder};
191 unmodified lines
216 nu_ansi_term::enable_ansi_support().is_ok() || std::env::var_os("TERM").is_some();217 #[cfg(not(windows))]218 let ansi_colors_support = true;219220 let interactive_terminal = atty::is(Stream::Stdout);220 let interactive_terminal = std::io::stdout().is_terminal();221 let colored_output = match opts.color {222 ColorWhen::Always => true,223 ColorWhen::Never => false,224 ColorWhen::Auto => {
247 unmodified lines
modified:Cargo.lock-22 removed
36 unmodified lines
37 "nix 0.24.3",38]3940[[package]]41name = "atty"42version = "0.2.14"43source = "registry+https://github.com/rust-lang/crates.io-index"44checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"45dependencies = [46 "hermit-abi 0.1.19",47 "libc",48 "winapi",49]5051[[package]]41name = "autocfg"42version = "1.1.0"43source = "registry+https://github.com/rust-lang/crates.io-index"44checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
270 unmodified lines
315version = "8.7.0"316dependencies = [317 "anyhow",318 "argmax",330 "atty",319 "chrono",320 "clap",321 "clap_complete",322 "crossbeam-channel",
11 unmodified lines
334 "nix 0.26.2",335 "normpath",336 "nu-ansi-term",337 "num_cpus",350 "once_cell",338 "regex",339 "regex-syntax",340 "tempfile",341 "test-case",
50 unmodified lines
392checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"393394[[package]]395name = "hermit-abi"409version = "0.1.19"410source = "registry+https://github.com/rust-lang/crates.io-index"411checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"412dependencies = [413 "libc",414]415416[[package]]417name = "hermit-abi"396version = "0.2.6"397source = "registry+https://github.com/rust-lang/crates.io-index"398checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"399dependencies = [
784 unmodified lines
modified:Cargo.toml+1 added-3 removed