Skip to content

Commit

Permalink
clippy: fix default_trait_access lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
cakebaker committed Jul 14, 2023
1 parent ec1d2fb commit 094d0e0
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 35 deletions.
18 changes: 9 additions & 9 deletions src/uu/dd/src/progress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ mod tests {

fn prog_update_write(n: u128) -> ProgUpdate {
ProgUpdate {
read_stat: Default::default(),
read_stat: ReadStat::default(),
write_stat: WriteStat {
bytes_total: n,
..Default::default()
Expand All @@ -510,8 +510,8 @@ mod tests {

fn prog_update_duration(duration: Duration) -> ProgUpdate {
ProgUpdate {
read_stat: Default::default(),
write_stat: Default::default(),
read_stat: ReadStat::default(),
write_stat: WriteStat::default(),
duration,
complete: false,
}
Expand Down Expand Up @@ -557,8 +557,8 @@ mod tests {
#[test]
fn test_prog_update_write_prog_line() {
let prog_update = ProgUpdate {
read_stat: Default::default(),
write_stat: Default::default(),
read_stat: ReadStat::default(),
write_stat: WriteStat::default(),
duration: Duration::new(1, 0), // one second
complete: false,
};
Expand Down Expand Up @@ -613,8 +613,8 @@ mod tests {
#[test]
fn write_transfer_stats() {
let prog_update = ProgUpdate {
read_stat: Default::default(),
write_stat: Default::default(),
read_stat: ReadStat::default(),
write_stat: WriteStat::default(),
duration: Duration::new(1, 0), // one second
complete: false,
};
Expand All @@ -634,8 +634,8 @@ mod tests {
fn write_final_transfer_stats() {
// Tests the formatting of the final statistics written after a progress line.
let prog_update = ProgUpdate {
read_stat: Default::default(),
write_stat: Default::default(),
read_stat: ReadStat::default(),
write_stat: WriteStat::default(),
duration: Duration::new(1, 0), // one second
complete: false,
};
Expand Down
8 changes: 4 additions & 4 deletions src/uu/df/src/df.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ mod tests {

#[test]
fn test_remote_included() {
let opt = Default::default();
let opt = Options::default();
let m = mount_info("ext4", "/mnt/foo", true, false);
assert!(is_included(&m, &opt));
}
Expand All @@ -773,7 +773,7 @@ mod tests {

#[test]
fn test_dummy_excluded() {
let opt = Default::default();
let opt = Options::default();
let m = mount_info("ext4", "/mnt/foo", false, true);
assert!(!is_included(&m, &opt));
}
Expand Down Expand Up @@ -864,11 +864,11 @@ mod tests {

mod filter_mount_list {

use crate::filter_mount_list;
use crate::{filter_mount_list, Options};

#[test]
fn test_empty() {
let opt = Default::default();
let opt = Options::default();
let mount_infos = vec![];
assert!(filter_mount_list(mount_infos, &opt).is_empty());
}
Expand Down
10 changes: 5 additions & 5 deletions src/uu/df/src/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ mod tests {
// Create a fake `MountInfo` with the given directory name.
fn mount_info(mount_dir: &str) -> MountInfo {
MountInfo {
dev_id: Default::default(),
dev_name: Default::default(),
fs_type: Default::default(),
dev_id: String::default(),
dev_name: String::default(),
fs_type: String::default(),
mount_dir: String::from(mount_dir),
mount_option: Default::default(),
mount_root: Default::default(),
mount_option: String::default(),
mount_root: String::default(),
remote: Default::default(),
dummy: Default::default(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/uu/df/src/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ mod tests {

#[test]
fn test_default_header() {
let options = Default::default();
let options = Options::default();
assert_eq!(
Header::get_headers(&options),
vec!(
Expand Down
24 changes: 12 additions & 12 deletions src/uu/sort/src/numeric_str_cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ mod tests {
fn parses_exp() {
let n = "1";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 0,
Expand All @@ -280,7 +280,7 @@ mod tests {
);
let n = "100";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 2,
Expand Down Expand Up @@ -308,7 +308,7 @@ mod tests {
);
let n = "1,000";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 0,
Expand All @@ -319,7 +319,7 @@ mod tests {
);
let n = "1000.00";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 3,
Expand All @@ -333,7 +333,7 @@ mod tests {
fn parses_negative_exp() {
let n = "0.00005";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: -5,
Expand All @@ -344,7 +344,7 @@ mod tests {
);
let n = "00000.00005";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: -5,
Expand All @@ -359,7 +359,7 @@ mod tests {
fn parses_sign() {
let n = "5";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 0,
Expand All @@ -370,7 +370,7 @@ mod tests {
);
let n = "-5";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 0,
Expand All @@ -381,7 +381,7 @@ mod tests {
);
let n = " -5";
assert_eq!(
NumInfo::parse(n, &Default::default()),
NumInfo::parse(n, &NumInfoParseSettings::default()),
(
NumInfo {
exponent: 0,
Expand All @@ -393,8 +393,8 @@ mod tests {
}

fn test_helper(a: &str, b: &str, expected: Ordering) {
let (a_info, a_range) = NumInfo::parse(a, &Default::default());
let (b_info, b_range) = NumInfo::parse(b, &Default::default());
let (a_info, a_range) = NumInfo::parse(a, &NumInfoParseSettings::default());
let (b_info, b_range) = NumInfo::parse(b, &NumInfoParseSettings::default());
let ordering = numeric_str_cmp(
(&a[a_range.to_owned()], &a_info),
(&b[b_range.to_owned()], &b_info),
Expand Down Expand Up @@ -469,7 +469,7 @@ mod tests {
}
#[test]
fn single_minus() {
let info = NumInfo::parse("-", &Default::default());
let info = NumInfo::parse("-", &NumInfoParseSettings::default());
assert_eq!(
info,
(
Expand Down
8 changes: 4 additions & 4 deletions src/uu/tail/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,21 +149,21 @@ impl Default for Settings {
Self {
max_unchanged_stats: 5,
sleep_sec: Duration::from_secs_f32(1.0),
follow: Default::default(),
mode: Default::default(),
follow: Option::default(),
mode: FilterMode::default(),
pid: Default::default(),
retry: Default::default(),
use_polling: Default::default(),
verbose: Default::default(),
presume_input_pipe: Default::default(),
inputs: Default::default(),
inputs: Vec::default(),
}
}
}

impl Settings {
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 {
settings.follow = if name.is_some() {
Some(FollowMode::Name)
Expand Down

0 comments on commit 094d0e0

Please sign in to comment.