Skip to content

Commit d2239f2

Browse files
committed
address feedback
1 parent f96d22f commit d2239f2

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

‎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
@@ -121,7 +121,7 @@ impl<'a> Context<'a> {
121121
let root_path = current_dir.join(root);
122122
let target_is_file = target.is_file();
123123
let root_parent = if target.exists() && !root.to_str().unwrap().ends_with("/.") {
124-
root_path.parent().map(Path::to_path_buf)
124+
root_path.parent().map(ToOwned::to_owned)
125125
} else if root == Path::new(".") && target.is_dir() {
126126
// Special case: when copying current directory (.) to an existing directory,
127127
// 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
@@ -193,7 +193,7 @@ mod tests {
193193
fn up_to_line_pattern() {
194194
let input: Vec<String> = vec!["24", "42", "{*}", "50", "{4}"]
195195
.into_iter()
196-
.map(ToString::to_string)
196+
.map(ToOwned::to_owned)
197197
.collect();
198198
let patterns = get_patterns(input.as_slice()).unwrap();
199199
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)