mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
clippy: fix default_trait_access lint warnings
This commit is contained in:
parent
ec1d2fba33
commit
424d51285c
7 changed files with 36 additions and 36 deletions
|
@ -498,7 +498,7 @@ mod tests {
|
||||||
|
|
||||||
fn prog_update_write(n: u128) -> ProgUpdate {
|
fn prog_update_write(n: u128) -> ProgUpdate {
|
||||||
ProgUpdate {
|
ProgUpdate {
|
||||||
read_stat: Default::default(),
|
read_stat: ReadStat::default(),
|
||||||
write_stat: WriteStat {
|
write_stat: WriteStat {
|
||||||
bytes_total: n,
|
bytes_total: n,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -510,8 +510,8 @@ mod tests {
|
||||||
|
|
||||||
fn prog_update_duration(duration: Duration) -> ProgUpdate {
|
fn prog_update_duration(duration: Duration) -> ProgUpdate {
|
||||||
ProgUpdate {
|
ProgUpdate {
|
||||||
read_stat: Default::default(),
|
read_stat: ReadStat::default(),
|
||||||
write_stat: Default::default(),
|
write_stat: WriteStat::default(),
|
||||||
duration,
|
duration,
|
||||||
complete: false,
|
complete: false,
|
||||||
}
|
}
|
||||||
|
@ -557,8 +557,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_prog_update_write_prog_line() {
|
fn test_prog_update_write_prog_line() {
|
||||||
let prog_update = ProgUpdate {
|
let prog_update = ProgUpdate {
|
||||||
read_stat: Default::default(),
|
read_stat: ReadStat::default(),
|
||||||
write_stat: Default::default(),
|
write_stat: WriteStat::default(),
|
||||||
duration: Duration::new(1, 0), // one second
|
duration: Duration::new(1, 0), // one second
|
||||||
complete: false,
|
complete: false,
|
||||||
};
|
};
|
||||||
|
@ -613,8 +613,8 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn write_transfer_stats() {
|
fn write_transfer_stats() {
|
||||||
let prog_update = ProgUpdate {
|
let prog_update = ProgUpdate {
|
||||||
read_stat: Default::default(),
|
read_stat: ReadStat::default(),
|
||||||
write_stat: Default::default(),
|
write_stat: WriteStat::default(),
|
||||||
duration: Duration::new(1, 0), // one second
|
duration: Duration::new(1, 0), // one second
|
||||||
complete: false,
|
complete: false,
|
||||||
};
|
};
|
||||||
|
@ -634,8 +634,8 @@ mod tests {
|
||||||
fn write_final_transfer_stats() {
|
fn write_final_transfer_stats() {
|
||||||
// Tests the formatting of the final statistics written after a progress line.
|
// Tests the formatting of the final statistics written after a progress line.
|
||||||
let prog_update = ProgUpdate {
|
let prog_update = ProgUpdate {
|
||||||
read_stat: Default::default(),
|
read_stat: ReadStat::default(),
|
||||||
write_stat: Default::default(),
|
write_stat: WriteStat::default(),
|
||||||
duration: Duration::new(1, 0), // one second
|
duration: Duration::new(1, 0), // one second
|
||||||
complete: false,
|
complete: false,
|
||||||
};
|
};
|
||||||
|
|
|
@ -746,7 +746,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_remote_included() {
|
fn test_remote_included() {
|
||||||
let opt = Default::default();
|
let opt = Options::default();
|
||||||
let m = mount_info("ext4", "/mnt/foo", true, false);
|
let m = mount_info("ext4", "/mnt/foo", true, false);
|
||||||
assert!(is_included(&m, &opt));
|
assert!(is_included(&m, &opt));
|
||||||
}
|
}
|
||||||
|
@ -773,7 +773,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_dummy_excluded() {
|
fn test_dummy_excluded() {
|
||||||
let opt = Default::default();
|
let opt = Options::default();
|
||||||
let m = mount_info("ext4", "/mnt/foo", false, true);
|
let m = mount_info("ext4", "/mnt/foo", false, true);
|
||||||
assert!(!is_included(&m, &opt));
|
assert!(!is_included(&m, &opt));
|
||||||
}
|
}
|
||||||
|
@ -864,11 +864,11 @@ mod tests {
|
||||||
|
|
||||||
mod filter_mount_list {
|
mod filter_mount_list {
|
||||||
|
|
||||||
use crate::filter_mount_list;
|
use crate::{filter_mount_list, Options};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_empty() {
|
fn test_empty() {
|
||||||
let opt = Default::default();
|
let opt = Options::default();
|
||||||
let mount_infos = vec![];
|
let mount_infos = vec![];
|
||||||
assert!(filter_mount_list(mount_infos, &opt).is_empty());
|
assert!(filter_mount_list(mount_infos, &opt).is_empty());
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,12 +158,12 @@ mod tests {
|
||||||
// Create a fake `MountInfo` with the given directory name.
|
// Create a fake `MountInfo` with the given directory name.
|
||||||
fn mount_info(mount_dir: &str) -> MountInfo {
|
fn mount_info(mount_dir: &str) -> MountInfo {
|
||||||
MountInfo {
|
MountInfo {
|
||||||
dev_id: Default::default(),
|
dev_id: String::default(),
|
||||||
dev_name: Default::default(),
|
dev_name: String::default(),
|
||||||
fs_type: Default::default(),
|
fs_type: String::default(),
|
||||||
mount_dir: String::from(mount_dir),
|
mount_dir: String::from(mount_dir),
|
||||||
mount_option: Default::default(),
|
mount_option: String::default(),
|
||||||
mount_root: Default::default(),
|
mount_root: String::default(),
|
||||||
remote: Default::default(),
|
remote: Default::default(),
|
||||||
dummy: Default::default(),
|
dummy: Default::default(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_default_header() {
|
fn test_default_header() {
|
||||||
let options = Default::default();
|
let options = Options::default();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Header::get_headers(&options),
|
Header::get_headers(&options),
|
||||||
vec!(
|
vec!(
|
||||||
|
|
|
@ -575,7 +575,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn test_options_correct_defaults() {
|
fn test_options_correct_defaults() {
|
||||||
let opts: HeadOptions = Default::default();
|
let opts = HeadOptions::default();
|
||||||
|
|
||||||
assert!(!opts.verbose);
|
assert!(!opts.verbose);
|
||||||
assert!(!opts.quiet);
|
assert!(!opts.quiet);
|
||||||
|
|
|
@ -269,7 +269,7 @@ mod tests {
|
||||||
fn parses_exp() {
|
fn parses_exp() {
|
||||||
let n = "1";
|
let n = "1";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 0,
|
exponent: 0,
|
||||||
|
@ -280,7 +280,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
let n = "100";
|
let n = "100";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 2,
|
exponent: 2,
|
||||||
|
@ -308,7 +308,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
let n = "1,000";
|
let n = "1,000";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 0,
|
exponent: 0,
|
||||||
|
@ -319,7 +319,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
let n = "1000.00";
|
let n = "1000.00";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 3,
|
exponent: 3,
|
||||||
|
@ -333,7 +333,7 @@ mod tests {
|
||||||
fn parses_negative_exp() {
|
fn parses_negative_exp() {
|
||||||
let n = "0.00005";
|
let n = "0.00005";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: -5,
|
exponent: -5,
|
||||||
|
@ -344,7 +344,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
let n = "00000.00005";
|
let n = "00000.00005";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: -5,
|
exponent: -5,
|
||||||
|
@ -359,7 +359,7 @@ mod tests {
|
||||||
fn parses_sign() {
|
fn parses_sign() {
|
||||||
let n = "5";
|
let n = "5";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 0,
|
exponent: 0,
|
||||||
|
@ -370,7 +370,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
let n = "-5";
|
let n = "-5";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 0,
|
exponent: 0,
|
||||||
|
@ -381,7 +381,7 @@ mod tests {
|
||||||
);
|
);
|
||||||
let n = " -5";
|
let n = " -5";
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NumInfo::parse(n, &Default::default()),
|
NumInfo::parse(n, &NumInfoParseSettings::default()),
|
||||||
(
|
(
|
||||||
NumInfo {
|
NumInfo {
|
||||||
exponent: 0,
|
exponent: 0,
|
||||||
|
@ -393,8 +393,8 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_helper(a: &str, b: &str, expected: Ordering) {
|
fn test_helper(a: &str, b: &str, expected: Ordering) {
|
||||||
let (a_info, a_range) = NumInfo::parse(a, &Default::default());
|
let (a_info, a_range) = NumInfo::parse(a, &NumInfoParseSettings::default());
|
||||||
let (b_info, b_range) = NumInfo::parse(b, &Default::default());
|
let (b_info, b_range) = NumInfo::parse(b, &NumInfoParseSettings::default());
|
||||||
let ordering = numeric_str_cmp(
|
let ordering = numeric_str_cmp(
|
||||||
(&a[a_range.to_owned()], &a_info),
|
(&a[a_range.to_owned()], &a_info),
|
||||||
(&b[b_range.to_owned()], &b_info),
|
(&b[b_range.to_owned()], &b_info),
|
||||||
|
@ -469,7 +469,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
#[test]
|
#[test]
|
||||||
fn single_minus() {
|
fn single_minus() {
|
||||||
let info = NumInfo::parse("-", &Default::default());
|
let info = NumInfo::parse("-", &NumInfoParseSettings::default());
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
info,
|
info,
|
||||||
(
|
(
|
||||||
|
|
|
@ -149,21 +149,21 @@ impl Default for Settings {
|
||||||
Self {
|
Self {
|
||||||
max_unchanged_stats: 5,
|
max_unchanged_stats: 5,
|
||||||
sleep_sec: Duration::from_secs_f32(1.0),
|
sleep_sec: Duration::from_secs_f32(1.0),
|
||||||
follow: Default::default(),
|
follow: Option::default(),
|
||||||
mode: Default::default(),
|
mode: FilterMode::default(),
|
||||||
pid: Default::default(),
|
pid: Default::default(),
|
||||||
retry: Default::default(),
|
retry: Default::default(),
|
||||||
use_polling: Default::default(),
|
use_polling: Default::default(),
|
||||||
verbose: Default::default(),
|
verbose: Default::default(),
|
||||||
presume_input_pipe: Default::default(),
|
presume_input_pipe: Default::default(),
|
||||||
inputs: Default::default(),
|
inputs: Vec::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
pub fn from_obsolete_args(args: &parse::ObsoleteArgs, name: Option<&OsString>) -> Self {
|
pub fn from_obsolete_args(args: &parse::ObsoleteArgs, name: Option<&OsString>) -> Self {
|
||||||
let mut settings: Self = Default::default();
|
let mut settings = Self::default();
|
||||||
if args.follow {
|
if args.follow {
|
||||||
settings.follow = if name.is_some() {
|
settings.follow = if name.is_some() {
|
||||||
Some(FollowMode::Name)
|
Some(FollowMode::Name)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue