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

Merge pull request #1997 from sylvestre/polish3

Rustfmt+clippy+cargo.lock update
This commit is contained in:
Sylvestre Ledru 2021-04-02 11:37:56 +02:00 committed by GitHub
commit de6aa69259
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 24 additions and 26 deletions

10
Cargo.lock generated
View file

@ -1,7 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "advapi32-sys"
version = "0.2.0"
@ -982,9 +980,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
[[package]]
name = "proc-macro2"
version = "1.0.24"
version = "1.0.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71"
checksum = "a152013215dca273577e18d2bf00fa862b89b24169fb78c4c95aeb07992c9cec"
dependencies = [
"unicode-xid 0.2.1",
]
@ -1356,9 +1354,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
name = "syn"
version = "1.0.67"
version = "1.0.68"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6498a9efc342871f91cc2d0d694c674368b4ceb40f62b65a7a08c3792935e702"
checksum = "3ce15dd3ed8aa2f8eeac4716d6ef5ab58b6b9256db41d7e1a0224c2788e8fd87"
dependencies = [
"proc-macro2",
"quote 1.0.9",

View file

@ -147,7 +147,7 @@ fn cksum(fname: &str) -> io::Result<(u32, usize)> {
"Is a directory",
));
};
if !path.metadata().is_ok() {
if path.metadata().is_err() {
return Err(std::io::Error::new(
io::ErrorKind::NotFound,
"No such file or directory",

View file

@ -26,9 +26,9 @@ use time::Timespec;
#[cfg(windows)]
use winapi::shared::minwindef::{DWORD, LPVOID};
#[cfg(windows)]
use winapi::um::fileapi::{FILE_STANDARD_INFO, FILE_ID_INFO};
use winapi::um::fileapi::{FILE_ID_INFO, FILE_STANDARD_INFO};
#[cfg(windows)]
use winapi::um::minwinbase::{FileStandardInfo, FileIdInfo};
use winapi::um::minwinbase::{FileIdInfo, FileStandardInfo};
#[cfg(windows)]
use winapi::um::winbase::GetFileInformationByHandleEx;
#[cfg(windows)]

View file

@ -36,7 +36,6 @@ const AFTER_HELP: &str = r#"
\\xHH byte with hexadecimal value HH (1 to 2 digits)
"#;
mod options {
pub const STRING: &str = "STRING";
pub const NO_NEWLINE: &str = "no_newline";

View file

@ -81,7 +81,7 @@ pub fn break_lines(para: &Paragraph, opts: &FmtOptions, ostream: &mut BufWriter<
let mut break_args = BreakArgs {
opts,
init_len: p_init_len,
indent_str: &p_indent[..],
indent_str: p_indent,
indent_len: p_indent_len,
uniform,
ostream,

View file

@ -223,7 +223,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
} else if matches.is_present(OPT_BACKUP) {
match matches.value_of(OPT_BACKUP) {
None => BackupMode::ExistingBackup,
Some(mode) => match &mode[..] {
Some(mode) => match mode {
"simple" | "never" => BackupMode::SimpleBackup,
"numbered" | "t" => BackupMode::NumberedBackup,
"existing" | "nil" => BackupMode::ExistingBackup,

View file

@ -270,14 +270,12 @@ impl Config {
.any(|i| i >= idx)
{
format = Format::Long;
} else {
if let Some(mut indices) = options.indices_of(options::format::ONELINE) {
} else if let Some(mut indices) = options.indices_of(options::format::ONELINE) {
if indices.any(|i| i > idx) {
format = Format::OneLine;
}
}
}
}
let files = if options.is_present(options::files::ALL) {
Files::All

View file

@ -37,7 +37,7 @@ pub fn parse_options(settings: &mut crate::Settings, opts: &clap::ArgMatches) ->
}
match opts.value_of(options::NUMBER_FORMAT) {
None => {}
Some(val) => match val.as_ref() {
Some(val) => match val {
"ln" => {
settings.number_format = crate::NumberFormat::Left;
}

View file

@ -59,7 +59,7 @@ fn get_primitive_hex(
// assign 0
let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos {
Some(pos) => (&str_in[..pos], &str_in[pos + 1..]),
None => (&str_in[..], "0"),
None => (str_in, "0"),
};
if first_segment_raw.is_empty() {
first_segment_raw = "0";

View file

@ -218,7 +218,7 @@ pub fn get_primitive_dec(
// assign 0
let (mut first_segment_raw, second_segment_raw) = match analysis.decimal_pos {
Some(pos) => (&str_in[..pos], &str_in[pos + 1..]),
None => (&str_in[..], "0"),
None => (str_in, "0"),
};
if first_segment_raw.is_empty() {
first_segment_raw = "0";

View file

@ -338,7 +338,7 @@ this is the default for non-regular files",
Some(s) => match s.parse::<usize>() {
Ok(u) => u,
Err(_) => {
errs.push(String::from(format!("invalid number of passes: '{}'", s)));
errs.push(format!("invalid number of passes: '{}'", s));
0
}
},

View file

@ -493,13 +493,13 @@ fn get_leading_number(a: &str) -> &str {
fn num_sort_dedup(a: &str) -> &str {
// Empty lines are dumped
if a.is_empty() {
return "0"
return "0";
// And lines that don't begin numerically are dumped
} else if !a.trim().chars().nth(0).unwrap_or('\0').is_numeric() {
return "0"
return "0";
} else {
// Prepare lines for comparison of only the numerical leading numbers
return get_leading_number(a)
return get_leading_number(a);
};
}

View file

@ -1,8 +1,11 @@
#![allow(dead_code)]
#[cfg(not(windows))]
use libc;
use std::env;
use std::ffi::{CString, OsStr};
#[cfg(not(windows))]
use std::ffi::CString;
use std::ffi::OsStr;
use std::fs::{self, File, OpenOptions};
use std::io::{Read, Result, Write};
#[cfg(unix)]