Skip to content

Commit bec2f8e

Browse files
committed
address feedback
1 parent 07a6dad commit bec2f8e

4 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/uu/checksum_common/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
// spell-checker:ignore (ToDO) algo
77

8+
use std::borrow::Borrow;
89
use std::ffi::OsString;
910

1011
use clap::builder::ValueParser;
@@ -159,7 +160,7 @@ pub fn checksum_main(
159160
let files = matches
160161
.get_many::<OsString>(options::FILE)
161162
.unwrap()
162-
.map(OsString::as_os_str);
163+
.map(Borrow::borrow);
163164

164165
if check {
165166
// cksum does not support '--check'ing legacy algorithms

src/uu/cp/src/copydir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<'a> Context<'a> {
111111
let root_path = current_dir.join(root);
112112
let target_is_file = target.is_file();
113113
let root_parent = if target.exists() && !root.to_str().unwrap().ends_with("/.") {
114-
root_path.parent().map(Path::to_path_buf)
114+
root_path.parent().map(ToOwned::to_owned)
115115
} else if root == Path::new(".") && target.is_dir() {
116116
// Special case: when copying current directory (.) to an existing directory,
117117
// we don't want to use the parent path as root_parent because we want to

src/uu/csplit/src/patterns.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ mod tests {
196196
fn up_to_line_pattern() {
197197
let input: Vec<String> = vec!["24", "42", "{*}", "50", "{4}"]
198198
.into_iter()
199-
.map(ToString::to_string)
199+
.map(ToOwned::to_owned)
200200
.collect();
201201
let patterns = get_patterns(input.as_slice()).unwrap();
202202
assert_eq!(patterns.len(), 3);

src/uu/env/src/native_int_str.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl<'a> NativeStr<'a> {
257257
let n_prefix = to_native_int_representation(prefix);
258258
let result = self.match_cow(
259259
|b| b.strip_prefix(&*n_prefix).ok_or(()),
260-
|o| o.strip_prefix(&*n_prefix).map(<[_]>::to_vec).ok_or(()),
260+
|o| o.strip_prefix(&*n_prefix).map(ToOwned::to_owned).ok_or(()),
261261
);
262262
result.ok()
263263
}
@@ -266,7 +266,7 @@ impl<'a> NativeStr<'a> {
266266
let n_prefix = to_native_int_representation(prefix);
267267
let result = self.match_cow_native(
268268
|b| b.strip_prefix(&*n_prefix).ok_or(()),
269-
|o| o.strip_prefix(&*n_prefix).map(<[_]>::to_vec).ok_or(()),
269+
|o| o.strip_prefix(&*n_prefix).map(ToOwned::to_owned).ok_or(()),
270270
);
271271
result.ok()
272272
}

0 commit comments

Comments
 (0)