1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

factor: update to clap 4

This commit is contained in:
Terts Diepraam 2022-09-29 18:18:11 +02:00
parent 86d24176e4
commit 458c2c8b85
3 changed files with 8 additions and 7 deletions

View file

@ -15,7 +15,7 @@ edition = "2021"
num-traits = "0.2.15" # used in src/numerics.rs, which is included by build.rs
[dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
clap = { version = "4.0", features = ["wrap_help", "cargo"] }
coz = { version = "0.1.3", optional = true }
num-traits = "0.2.15" # Needs at least version 0.2.15 for "OverflowingAdd"
rand = { version = "0.8", features = ["small_rng"] }

View file

@ -15,7 +15,7 @@ use std::io::BufRead;
use std::io::{self, stdin, stdout, Write};
mod factor;
use clap::{crate_version, Arg, Command};
use clap::{crate_version, Arg, ArgAction, Command};
pub use factor::*;
use uucore::display::Quotable;
use uucore::error::UResult;
@ -78,10 +78,10 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
Ok(())
}
pub fn uu_app<'a>() -> Command<'a> {
pub fn uu_app() -> Command {
Command::new(uucore::util_name())
.version(crate_version!())
.about(ABOUT)
.infer_long_args(true)
.arg(Arg::new(options::NUMBER).multiple_occurrences(true))
.arg(Arg::new(options::NUMBER).action(ArgAction::Append))
}

View file

@ -8,10 +8,8 @@
// spell-checker:ignore (methods) hexdigest
use tempfile::TempDir;
use crate::common::util::*;
use std::fs::OpenOptions;
use std::time::SystemTime;
#[path = "../../src/uu/factor/sieve.rs"]
@ -33,9 +31,12 @@ fn test_invalid_arg() {
}
#[test]
#[cfg(feature = "sort")]
fn test_parallel() {
use hex_literal::hex;
use sha1::{Digest, Sha1};
use std::fs::OpenOptions;
use tempfile::TempDir;
// factor should only flush the buffer at line breaks
let n_integers = 100_000;
let mut input_string = String::new();