Skip to content

Commit 6cb5831

Browse files
committed
cargo fmt
1 parent 55a5e45 commit 6cb5831

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

datetime/tests/datetime-tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
// SPDX-License-Identifier: MIT
88
//
99

10-
mod time;
10+
mod time;

datetime/tests/time/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
// SPDX-License-Identifier: MIT
88
//
99

10-
use std::{io::Write, process::{Command, Output, Stdio}};
10+
use std::{
11+
io::Write,
12+
process::{Command, Output, Stdio},
13+
};
1114

1215
use plib::TestPlan;
1316

@@ -87,4 +90,4 @@ fn parse_error_test() {
8790
#[test]
8891
fn command_error_test() {
8992
run_test_time(&["-s", "ls", "-l"], "", "unexpected argument found", 0);
90-
}
93+
}

datetime/time.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// SPDX-License-Identifier: MIT
88
//
99

10+
use std::io::{self, Write};
1011
use std::process::{Command, Stdio};
1112
use std::time::Instant;
12-
use std::io::{self, Write};
1313

1414
use clap::Parser;
1515

@@ -56,11 +56,9 @@ fn time(args: Args) -> Result<(), TimeError> {
5656
.stdout(Stdio::inherit())
5757
.stderr(Stdio::inherit())
5858
.spawn()
59-
.map_err(|e| {
60-
match e.kind() {
61-
io::ErrorKind::NotFound => TimeError::CommandNotFound(args.utility),
62-
_ => TimeError::ExecCommand(args.utility),
63-
}
59+
.map_err(|e| match e.kind() {
60+
io::ErrorKind::NotFound => TimeError::CommandNotFound(args.utility),
61+
_ => TimeError::ExecCommand(args.utility),
6462
})?;
6563

6664
let _ = child.wait().map_err(|_| TimeError::ExecTime)?;
@@ -78,15 +76,17 @@ fn time(args: Args) -> Result<(), TimeError> {
7876
elapsed.as_secs_f64(),
7977
user_time,
8078
system_time
81-
).map_err(|_| TimeError::ExecTime)?;
79+
)
80+
.map_err(|_| TimeError::ExecTime)?;
8281
} else {
8382
writeln!(
8483
io::stderr(),
8584
"Elapsed time: {:.6} seconds\nUser time: {:.6} seconds\nSystem time: {:.6} seconds",
8685
elapsed.as_secs_f64(),
8786
user_time,
8887
system_time
89-
).map_err(|_| TimeError::ExecTime)?;
88+
)
89+
.map_err(|_| TimeError::ExecTime)?;
9090
}
9191

9292
Ok(())
@@ -112,8 +112,7 @@ impl Status {
112112
}
113113
}
114114

115-
116-
fn main() -> Result<(), Box<dyn std::error::Error>> {
115+
fn main() -> Result<(), Box<dyn std::error::Error>> {
117116
let args = Args::parse();
118117

119118
setlocale(LocaleCategory::LcAll, "");
@@ -125,15 +124,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
125124
TimeError::CommandNotFound(err) => {
126125
eprintln!("Command not found: {}", err);
127126
Status::UtilNotFound.exit()
128-
},
127+
}
129128
TimeError::ExecCommand(err) => {
130129
eprintln!("Error while executing command: {}", err);
131130
Status::UtilError.exit()
132131
}
133132
TimeError::ExecTime => {
134133
eprintln!("Error while executing time utility");
135134
Status::TimeError.exit()
136-
},
135+
}
137136
}
138137
}
139138

0 commit comments

Comments
 (0)