Skip to content

Commit 4482bdb

Browse files
Fix clippy warnings
1 parent b8001cc commit 4482bdb

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/context_diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,12 +269,12 @@ fn make_diff(
269269
#[must_use]
270270
pub fn diff(expected: &[u8], actual: &[u8], params: &Params) -> Vec<u8> {
271271
let from_modified_time =
272-
match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with("-") {
272+
match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with('-') {
273273
true => get_modification_time(&params.stdin_path.to_string_lossy()),
274274
false => get_modification_time(&params.from.to_string_lossy()),
275275
};
276276
let to_modified_time =
277-
match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with("-") {
277+
match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with('-') {
278278
true => get_modification_time(&params.stdin_path.to_string_lossy()),
279279
false => get_modification_time(&params.to.to_string_lossy()),
280280
};

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() -> ExitCode {
4747
}
4848
// read files
4949
fn read_file_contents(filepath: &OsString, stdin_path: &OsString) -> io::Result<Vec<u8>> {
50-
if filepath.to_string_lossy().starts_with("-") && !stdin_path.is_empty() {
50+
if filepath.to_string_lossy().starts_with('-') && !stdin_path.is_empty() {
5151
fs::read(stdin_path)
5252
} else if filepath == "-" {
5353
let mut content = Vec::new();

src/params.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,11 @@ pub fn parse_params<I: IntoIterator<Item = OsString>>(opts: I) -> Result<Params,
190190
let file = File::from(fd);
191191
let meta = file.metadata().unwrap();
192192
if meta.is_dir() {
193-
let stdin = fs::canonicalize("/dev/stdin").unwrap();
194-
let mut stdin_path: PathBuf = PathBuf::from(stdin);
193+
let mut stdin_path = fs::canonicalize("/dev/stdin").unwrap();
195194
if params.from == "-" {
196-
stdin_path.push(&to_path.file_name().unwrap());
195+
stdin_path.push(to_path.file_name().unwrap());
197196
} else {
198-
stdin_path.push(&from_path.file_name().unwrap());
197+
stdin_path.push(from_path.file_name().unwrap());
199198
}
200199
params.stdin_path = stdin_path.into();
201200
}

src/unified_diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,12 +240,12 @@ fn make_diff(
240240
#[must_use]
241241
pub fn diff(expected: &[u8], actual: &[u8], params: &Params) -> Vec<u8> {
242242
let from_modified_time =
243-
match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with("-") {
243+
match !params.stdin_path.is_empty() && params.from.to_string_lossy().starts_with('-') {
244244
true => get_modification_time(&params.stdin_path.to_string_lossy()),
245245
false => get_modification_time(&params.from.to_string_lossy()),
246246
};
247247
let to_modified_time =
248-
match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with("-") {
248+
match !params.stdin_path.is_empty() && params.to.to_string_lossy().starts_with('-') {
249249
true => get_modification_time(&params.stdin_path.to_string_lossy()),
250250
false => get_modification_time(&params.to.to_string_lossy()),
251251
};

0 commit comments

Comments
 (0)