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

Merge pull request #3805 from cakebaker/clippy_deriving_eq

Fix clippy warnings with Rust 1.63
This commit is contained in:
Sylvestre Ledru 2022-08-12 17:48:42 +02:00 committed by GitHub
commit fc14c6e7a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 15 additions and 11 deletions

View file

@ -49,7 +49,7 @@ use winapi::um::minwinbase::{FileIdInfo, FileStandardInfo};
#[cfg(windows)]
use winapi::um::winbase::GetFileInformationByHandleEx;
#[cfg(windows)]
use winapi::um::winnt::{FILE_ID_128, ULONGLONG};
use winapi::um::winnt::FILE_ID_128;
mod options {
pub const HELP: &str = "help";
@ -254,7 +254,7 @@ fn get_file_info(path: &Path) -> Option<FileInfo> {
if success != 0 {
result = Some(FileInfo {
file_id: std::mem::transmute::<FILE_ID_128, u128>(file_info.FileId),
dev_id: std::mem::transmute::<ULONGLONG, u64>(file_info.VolumeSerialNumber),
dev_id: file_info.VolumeSerialNumber,
});
}
}

View file

@ -74,7 +74,7 @@ impl RoundMethod {
}
// Represents the options extracted from the --format argument provided by the user.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct FormatOptions {
pub grouping: bool,
pub padding: Option<isize>,

View file

@ -17,7 +17,7 @@ pub const IEC_BASES: [f64; 10] = [
pub type WithI = bool;
#[derive(Clone, Copy, PartialEq)]
#[derive(Clone, Copy, PartialEq, Eq)]
pub enum Unit {
Auto,
Si,

View file

@ -491,7 +491,7 @@ fn pathbuf_from_stdout() -> UResult<PathBuf> {
// to a u32.
let ret = unsafe {
GetFinalPathNameByHandleW(
std::mem::transmute(handle),
handle,
file_path_buffer.as_mut_ptr(),
file_path_buffer.len() as u32,
FILE_NAME_OPENED,

View file

@ -1,3 +1,5 @@
// TODO fix broken links
#![allow(rustdoc::broken_intra_doc_links)]
//! Macros for the uucore utilities.
//!
//! This module bundles all macros used across the uucore utilities. These
@ -28,7 +30,7 @@
//! - Terminate util execution
//! - Crash program: [`crash!`], [`crash_if_err!`]
// spell-checker:ignore sourcepath targetpath
// spell-checker:ignore sourcepath targetpath rustdoc
use std::sync::atomic::AtomicBool;

View file

@ -1,3 +1,5 @@
// TODO fix broken links
#![allow(rustdoc::broken_intra_doc_links)]
//! All utils return exit with an exit code. Usually, the following scheme is used:
//! * `0`: succeeded
//! * `1`: minor problems
@ -48,7 +50,7 @@
//! * Using [`ExitCode`] is not recommended but can be useful for converting utils to use
//! [`UResult`].
// spell-checker:ignore uioerror
// spell-checker:ignore uioerror rustdoc
use clap;
use std::{

View file

@ -404,8 +404,8 @@ fn test_with_pr_core_utils_tests() {
for test_case in test_cases {
let (flags, input_file, expected_file, return_code) = test_case;
let mut scenario = new_ucmd!();
let input_file_path = input_file.get(0).unwrap();
let test_file_path = expected_file.get(0).unwrap();
let input_file_path = input_file.first().unwrap();
let test_file_path = expected_file.first().unwrap();
let value = file_last_modified_time(&scenario, test_file_path);
let mut arguments: Vec<&str> = flags
.split(' ')

View file

@ -982,7 +982,7 @@ impl UCommand {
tmpd: Rc<TempDir>,
env_clear: bool,
) -> Self {
let tmpd_path_buf = String::from(&(*tmpd.as_ref().path().to_str().unwrap()));
let tmpd_path_buf = String::from(tmpd.as_ref().path().to_str().unwrap());
let mut ucmd: Self = Self::new(bin_path, util_name, tmpd_path_buf, env_clear);
ucmd.tmpd = Some(tmpd);
ucmd
@ -1296,7 +1296,7 @@ pub fn check_coreutil_version(
std::str::from_utf8(&version_check.stdout).unwrap()
.split('\n')
.collect::<Vec<_>>()
.get(0)
.first()
.map_or_else(
|| Err(format!("{}: unexpected output format for reference coreutil: '{} --version'", UUTILS_WARNING, util_name)),
|s| {