1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

fix a lot of clippy warnings

This commit is contained in:
Jan Scheer 2021-05-29 14:32:35 +02:00
parent fb812ff9d0
commit 3aeccfd802
48 changed files with 269 additions and 250 deletions

View file

@ -51,6 +51,7 @@ fn test_ls_a() {
.unwrap(),
);
#[allow(clippy::trivial_regex)]
let re_pwd = Regex::new(r"^\.\n").unwrap();
// Using the present working directory
@ -124,7 +125,7 @@ fn test_ls_width() {
for option in &["-w 100", "-w=100", "--width=100", "--width 100"] {
scene
.ucmd()
.args(&option.split(" ").collect::<Vec<_>>())
.args(&option.split(' ').collect::<Vec<_>>())
.succeeds()
.stdout_only("test-width-1 test-width-2 test-width-3 test-width-4\n");
}
@ -132,7 +133,7 @@ fn test_ls_width() {
for option in &["-w 50", "-w=50", "--width=50", "--width 50"] {
scene
.ucmd()
.args(&option.split(" ").collect::<Vec<_>>())
.args(&option.split(' ').collect::<Vec<_>>())
.succeeds()
.stdout_only("test-width-1 test-width-3\ntest-width-2 test-width-4\n");
}
@ -149,7 +150,7 @@ fn test_ls_width() {
] {
scene
.ucmd()
.args(&option.split(" ").collect::<Vec<_>>())
.args(&option.split(' ').collect::<Vec<_>>())
.succeeds()
.stdout_only("test-width-1\ntest-width-2\ntest-width-3\ntest-width-4\n");
}
@ -163,7 +164,7 @@ fn test_ls_width() {
for option in &["-w 1a", "-w=1a", "--width=1a", "--width 1a"] {
scene
.ucmd()
.args(&option.split(" ").collect::<Vec<_>>())
.args(&option.split(' ').collect::<Vec<_>>())
.fails()
.stderr_only("ls: invalid line width: 1a");
}
@ -417,7 +418,7 @@ fn test_ls_long_formats() {
] {
let result = scene
.ucmd()
.args(&arg.split(" ").collect::<Vec<_>>())
.args(&arg.split(' ').collect::<Vec<_>>())
.arg("test-long-formats")
.succeeds();
assert!(re_two.is_match(result.stdout_str()));
@ -427,7 +428,7 @@ fn test_ls_long_formats() {
let result = scene
.ucmd()
.arg("-n")
.args(&arg.split(" ").collect::<Vec<_>>())
.args(&arg.split(' ').collect::<Vec<_>>())
.arg("test-long-formats")
.succeeds();
assert!(re_two_num.is_match(result.stdout_str()));
@ -446,7 +447,7 @@ fn test_ls_long_formats() {
] {
let result = scene
.ucmd()
.args(&arg.split(" ").collect::<Vec<_>>())
.args(&arg.split(' ').collect::<Vec<_>>())
.arg("test-long-formats")
.succeeds();
assert!(re_one.is_match(result.stdout_str()));
@ -456,7 +457,7 @@ fn test_ls_long_formats() {
let result = scene
.ucmd()
.arg("-n")
.args(&arg.split(" ").collect::<Vec<_>>())
.args(&arg.split(' ').collect::<Vec<_>>())
.arg("test-long-formats")
.succeeds();
assert!(re_one_num.is_match(result.stdout_str()));
@ -478,7 +479,7 @@ fn test_ls_long_formats() {
] {
let result = scene
.ucmd()
.args(&arg.split(" ").collect::<Vec<_>>())
.args(&arg.split(' ').collect::<Vec<_>>())
.arg("test-long-formats")
.succeeds();
assert!(re_zero.is_match(result.stdout_str()));
@ -488,7 +489,7 @@ fn test_ls_long_formats() {
let result = scene
.ucmd()
.arg("-n")
.args(&arg.split(" ").collect::<Vec<_>>())
.args(&arg.split(' ').collect::<Vec<_>>())
.arg("test-long-formats")
.succeeds();
assert!(re_zero.is_match(result.stdout_str()));
@ -1063,7 +1064,7 @@ fn test_ls_indicator_style() {
for opt in options {
scene
.ucmd()
.arg(format!("{}", opt))
.arg(opt.to_string())
.succeeds()
.stdout_contains(&"/");
}
@ -1085,7 +1086,10 @@ fn test_ls_indicator_style() {
{
use self::unix_socket::UnixListener;
let dir = tempfile::Builder::new().prefix("unix_socket").tempdir().expect("failed to create dir");
let dir = tempfile::Builder::new()
.prefix("unix_socket")
.tempdir()
.expect("failed to create dir");
let socket_path = dir.path().join("sock");
let _listener = UnixListener::bind(&socket_path).expect("failed to create socket");