mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #2160 from sylvestre/polish5
Fix various clippy warnings
This commit is contained in:
commit
c579bdb8d5
8 changed files with 25 additions and 18 deletions
8
Cargo.lock
generated
8
Cargo.lock
generated
|
@ -1277,9 +1277,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "1.5.2"
|
version = "1.5.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1efb2352a0f4d4b128f734b5c44c79ff80117351138733f12f982fe3e2b13343"
|
checksum = "ce5f1ceb7f74abbce32601642fcf8e8508a8a8991e0621c7d750295b9095702b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"memchr 2.4.0",
|
"memchr 2.4.0",
|
||||||
|
@ -1297,9 +1297,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.6.24"
|
version = "0.6.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "00efb87459ba4f6fb2169d20f68565555688e1250ee6825cdf6254f8b48fafb2"
|
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "remove_dir_all"
|
name = "remove_dir_all"
|
||||||
|
|
|
@ -81,7 +81,7 @@ fn copy_exact(read_fd: RawFd, write_fd: RawFd, num_bytes: usize) -> nix::Result<
|
||||||
let mut buf = [0; BUF_SIZE];
|
let mut buf = [0; BUF_SIZE];
|
||||||
loop {
|
loop {
|
||||||
let read = unistd::read(read_fd, &mut buf[..left])?;
|
let read = unistd::read(read_fd, &mut buf[..left])?;
|
||||||
let written = unistd::write(write_fd, &mut buf[..read])?;
|
let written = unistd::write(write_fd, &buf[..read])?;
|
||||||
left -= written;
|
left -= written;
|
||||||
if left == 0 {
|
if left == 0 {
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -551,6 +551,10 @@ impl FromStr for Attribute {
|
||||||
fn add_all_attributes() -> Vec<Attribute> {
|
fn add_all_attributes() -> Vec<Attribute> {
|
||||||
use Attribute::*;
|
use Attribute::*;
|
||||||
|
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
let attr = vec![Ownership, Timestamps, Context, Xattr, Links];
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
let mut attr = vec![Ownership, Timestamps, Context, Xattr, Links];
|
let mut attr = vec![Ownership, Timestamps, Context, Xattr, Links];
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
|
|
|
@ -348,7 +348,7 @@ fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
fn set_system_datetime(_date: DateTime<Utc>) -> i32 {
|
||||||
eprintln!("date: setting the date is not supported by macOS");
|
eprintln!("date: setting the date is not supported by macOS");
|
||||||
return 1;
|
1
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(unix, not(target_os = "macos")))]
|
#[cfg(all(unix, not(target_os = "macos")))]
|
||||||
|
|
|
@ -172,7 +172,7 @@ pub fn factor(mut n: u64) -> Factors {
|
||||||
#[cfg(feature = "coz")]
|
#[cfg(feature = "coz")]
|
||||||
coz::end!("factorization");
|
coz::end!("factorization");
|
||||||
|
|
||||||
return r;
|
r
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|
|
@ -39,8 +39,6 @@ use std::{
|
||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
use chrono;
|
|
||||||
|
|
||||||
use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
|
use term_grid::{Cell, Direction, Filling, Grid, GridOptions};
|
||||||
|
|
||||||
use unicode_width::UnicodeWidthStr;
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
|
@ -103,7 +103,7 @@ fn test_relpath_with_from_with_d() {
|
||||||
at.mkdir_all(from);
|
at.mkdir_all(from);
|
||||||
|
|
||||||
// d is part of subpath -> expect relative path
|
// d is part of subpath -> expect relative path
|
||||||
let mut result_stdout = scene
|
let mut _result_stdout = scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg(to)
|
.arg(to)
|
||||||
.arg(from)
|
.arg(from)
|
||||||
|
@ -112,17 +112,17 @@ fn test_relpath_with_from_with_d() {
|
||||||
.stdout_move_str();
|
.stdout_move_str();
|
||||||
// relax rules for windows test environment
|
// relax rules for windows test environment
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
assert!(Path::new(&result_stdout).is_relative());
|
assert!(Path::new(&_result_stdout).is_relative());
|
||||||
|
|
||||||
// d is not part of subpath -> expect absolut path
|
// d is not part of subpath -> expect absolut path
|
||||||
result_stdout = scene
|
_result_stdout = scene
|
||||||
.ucmd()
|
.ucmd()
|
||||||
.arg(to)
|
.arg(to)
|
||||||
.arg(from)
|
.arg(from)
|
||||||
.arg("-dnon_existing")
|
.arg("-dnon_existing")
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_move_str();
|
.stdout_move_str();
|
||||||
assert!(Path::new(&result_stdout).is_absolute());
|
assert!(Path::new(&_result_stdout).is_absolute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,12 +135,12 @@ fn test_relpath_no_from_no_d() {
|
||||||
let to: &str = &convert_path(test.to);
|
let to: &str = &convert_path(test.to);
|
||||||
at.mkdir_all(to);
|
at.mkdir_all(to);
|
||||||
|
|
||||||
let result_stdout = scene.ucmd().arg(to).succeeds().stdout_move_str();
|
let _result_stdout = scene.ucmd().arg(to).succeeds().stdout_move_str();
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
assert_eq!(result_stdout, format!("{}\n", to));
|
assert_eq!(_result_stdout, format!("{}\n", to));
|
||||||
// relax rules for windows test environment
|
// relax rules for windows test environment
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
assert!(result_stdout.ends_with(&format!("{}\n", to)));
|
assert!(_result_stdout.ends_with(&format!("{}\n", to)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,12 @@ fn test_uname_kernel_version() {
|
||||||
fn test_uname_kernel() {
|
fn test_uname_kernel() {
|
||||||
let (_, mut ucmd) = at_and_ucmd!();
|
let (_, mut ucmd) = at_and_ucmd!();
|
||||||
|
|
||||||
let result = ucmd.arg("-o").succeeds();
|
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
assert!(result.stdout_str().to_lowercase().contains("linux"));
|
{
|
||||||
|
let result = ucmd.arg("-o").succeeds();
|
||||||
|
assert!(result.stdout_str().to_lowercase().contains("linux"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
let result = ucmd.arg("-o").succeeds();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue