mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 02:08:09 +00:00
refactor/polish ~ fix cargo clippy
complaints (number readability)
This commit is contained in:
parent
3da2a69e11
commit
11d68d3e51
5 changed files with 93 additions and 93 deletions
|
@ -43,7 +43,7 @@ fn parse_code(
|
|||
max_digits: u32,
|
||||
bits_per_digit: u32,
|
||||
) -> Option<char> {
|
||||
let mut ret = 0x80000000;
|
||||
let mut ret = 0x8000_0000;
|
||||
for _ in 0..max_digits {
|
||||
match input.peek().and_then(|c| c.to_digit(base)) {
|
||||
Some(n) => ret = (ret << bits_per_digit) | n,
|
||||
|
|
|
@ -131,8 +131,8 @@ fn test_inverter() {
|
|||
|
||||
#[test]
|
||||
fn test_generator() {
|
||||
let prime_10001 = Sieve::primes().skip(10000).next();
|
||||
assert_eq!(prime_10001, Some(104743));
|
||||
let prime_10001 = Sieve::primes().skip(10_000).next();
|
||||
assert_eq!(prime_10001, Some(104_743));
|
||||
}
|
||||
|
||||
const MAX_WIDTH: usize = 102;
|
||||
|
|
|
@ -125,7 +125,7 @@ pub fn is_prime(num: u64) -> bool {
|
|||
|
||||
// These witnesses detect all composites up to at least 2^64.
|
||||
// Discovered by Jim Sinclair, according to http://miller-rabin.appspot.com
|
||||
let witnesses = [2, 325, 9375, 28178, 450775, 9780504, 1795265022];
|
||||
let witnesses = [2, 325, 9_375, 28_178, 450_775, 9_780_504, 1_795_265_022];
|
||||
!witnesses
|
||||
.iter()
|
||||
.any(|&wit| witness(wit % num, exponent, num))
|
||||
|
|
|
@ -21,15 +21,15 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
|
|||
const IEC_BASES: [f64; 10] = [
|
||||
//premature optimization
|
||||
1.,
|
||||
1024.,
|
||||
1048576.,
|
||||
1073741824.,
|
||||
1099511627776.,
|
||||
1125899906842624.,
|
||||
1152921504606846976.,
|
||||
1180591620717411303424.,
|
||||
1208925819614629174706176.,
|
||||
1237940039285380274899124224.,
|
||||
1_024.,
|
||||
1_048_576.,
|
||||
1_073_741_824.,
|
||||
1_099_511_627_776.,
|
||||
1_125_899_906_842_624.,
|
||||
1_152_921_504_606_846_976.,
|
||||
1_180_591_620_717_411_303_424.,
|
||||
1_208_925_819_614_629_174_706_176.,
|
||||
1_237_940_039_285_380_274_899_124_224.,
|
||||
];
|
||||
|
||||
type Result<T> = std::result::Result<T, String>;
|
||||
|
|
|
@ -271,120 +271,120 @@ where
|
|||
|
||||
pub fn pretty_fstype<'a>(fstype: i64) -> Cow<'a, str> {
|
||||
match fstype {
|
||||
0x61636673 => "acfs".into(),
|
||||
0x6163_6673 => "acfs".into(),
|
||||
0xADF5 => "adfs".into(),
|
||||
0xADFF => "affs".into(),
|
||||
0x5346414F => "afs".into(),
|
||||
0x09041934 => "anon-inode FS".into(),
|
||||
0x61756673 => "aufs".into(),
|
||||
0x5346_414F => "afs".into(),
|
||||
0x0904_1934 => "anon-inode FS".into(),
|
||||
0x6175_6673 => "aufs".into(),
|
||||
0x0187 => "autofs".into(),
|
||||
0x42465331 => "befs".into(),
|
||||
0x62646576 => "bdevfs".into(),
|
||||
0x1BADFACE => "bfs".into(),
|
||||
0xCAFE4A11 => "bpf_fs".into(),
|
||||
0x42494E4D => "binfmt_misc".into(),
|
||||
0x9123683E => "btrfs".into(),
|
||||
0x73727279 => "btrfs_test".into(),
|
||||
0x00C36400 => "ceph".into(),
|
||||
0x0027E0EB => "cgroupfs".into(),
|
||||
0xFF534D42 => "cifs".into(),
|
||||
0x73757245 => "coda".into(),
|
||||
0x012FF7B7 => "coh".into(),
|
||||
0x62656570 => "configfs".into(),
|
||||
0x28CD3D45 => "cramfs".into(),
|
||||
0x453DCD28 => "cramfs-wend".into(),
|
||||
0x64626720 => "debugfs".into(),
|
||||
0x4246_5331 => "befs".into(),
|
||||
0x6264_6576 => "bdevfs".into(),
|
||||
0x1BAD_FACE => "bfs".into(),
|
||||
0xCAFE_4A11 => "bpf_fs".into(),
|
||||
0x4249_4E4D => "binfmt_misc".into(),
|
||||
0x9123_683E => "btrfs".into(),
|
||||
0x7372_7279 => "btrfs_test".into(),
|
||||
0x00C3_6400 => "ceph".into(),
|
||||
0x0027_E0EB => "cgroupfs".into(),
|
||||
0xFF53_4D42 => "cifs".into(),
|
||||
0x7375_7245 => "coda".into(),
|
||||
0x012F_F7B7 => "coh".into(),
|
||||
0x6265_6570 => "configfs".into(),
|
||||
0x28CD_3D45 => "cramfs".into(),
|
||||
0x453D_CD28 => "cramfs-wend".into(),
|
||||
0x6462_6720 => "debugfs".into(),
|
||||
0x1373 => "devfs".into(),
|
||||
0x1CD1 => "devpts".into(),
|
||||
0xF15F => "ecryptfs".into(),
|
||||
0xDE5E81E4 => "efivarfs".into(),
|
||||
0x00414A53 => "efs".into(),
|
||||
0xDE5E_81E4 => "efivarfs".into(),
|
||||
0x0041_4A53 => "efs".into(),
|
||||
0x5DF5 => "exofs".into(),
|
||||
0x137D => "ext".into(),
|
||||
0xEF53 => "ext2/ext3".into(),
|
||||
0xEF51 => "ext2".into(),
|
||||
0xF2F52010 => "f2fs".into(),
|
||||
0xF2F5_2010 => "f2fs".into(),
|
||||
0x4006 => "fat".into(),
|
||||
0x19830326 => "fhgfs".into(),
|
||||
0x65735546 => "fuseblk".into(),
|
||||
0x65735543 => "fusectl".into(),
|
||||
0x0BAD1DEA => "futexfs".into(),
|
||||
0x01161970 => "gfs/gfs2".into(),
|
||||
0x47504653 => "gpfs".into(),
|
||||
0x1983_0326 => "fhgfs".into(),
|
||||
0x6573_5546 => "fuseblk".into(),
|
||||
0x6573_5543 => "fusectl".into(),
|
||||
0x0BAD_1DEA => "futexfs".into(),
|
||||
0x0116_1970 => "gfs/gfs2".into(),
|
||||
0x4750_4653 => "gpfs".into(),
|
||||
0x4244 => "hfs".into(),
|
||||
0x482B => "hfs+".into(),
|
||||
0x4858 => "hfsx".into(),
|
||||
0x00C0FFEE => "hostfs".into(),
|
||||
0xF995E849 => "hpfs".into(),
|
||||
0x958458F6 => "hugetlbfs".into(),
|
||||
0x11307854 => "inodefs".into(),
|
||||
0x013111A8 => "ibrix".into(),
|
||||
0x2BAD1DEA => "inotifyfs".into(),
|
||||
0x00C0_FFEE => "hostfs".into(),
|
||||
0xF995_E849 => "hpfs".into(),
|
||||
0x9584_58F6 => "hugetlbfs".into(),
|
||||
0x1130_7854 => "inodefs".into(),
|
||||
0x0131_11A8 => "ibrix".into(),
|
||||
0x2BAD_1DEA => "inotifyfs".into(),
|
||||
0x9660 => "isofs".into(),
|
||||
0x4004 => "isofs".into(),
|
||||
0x4000 => "isofs".into(),
|
||||
0x07C0 => "jffs".into(),
|
||||
0x72B6 => "jffs2".into(),
|
||||
0x3153464A => "jfs".into(),
|
||||
0x6B414653 => "k-afs".into(),
|
||||
0xC97E8168 => "logfs".into(),
|
||||
0x0BD00BD0 => "lustre".into(),
|
||||
0x5346314D => "m1fs".into(),
|
||||
0x3153_464A => "jfs".into(),
|
||||
0x6B41_4653 => "k-afs".into(),
|
||||
0xC97E_8168 => "logfs".into(),
|
||||
0x0BD0_0BD0 => "lustre".into(),
|
||||
0x5346_314D => "m1fs".into(),
|
||||
0x137F => "minix".into(),
|
||||
0x138F => "minix (30 char.)".into(),
|
||||
0x2468 => "minix v2".into(),
|
||||
0x2478 => "minix v2 (30 char.)".into(),
|
||||
0x4D5A => "minix3".into(),
|
||||
0x19800202 => "mqueue".into(),
|
||||
0x1980_0202 => "mqueue".into(),
|
||||
0x4D44 => "msdos".into(),
|
||||
0x564C => "novell".into(),
|
||||
0x6969 => "nfs".into(),
|
||||
0x6E667364 => "nfsd".into(),
|
||||
0x6E66_7364 => "nfsd".into(),
|
||||
0x3434 => "nilfs".into(),
|
||||
0x6E736673 => "nsfs".into(),
|
||||
0x5346544E => "ntfs".into(),
|
||||
0x6E73_6673 => "nsfs".into(),
|
||||
0x5346_544E => "ntfs".into(),
|
||||
0x9FA1 => "openprom".into(),
|
||||
0x7461636F => "ocfs2".into(),
|
||||
0x794C7630 => "overlayfs".into(),
|
||||
0xAAD7AAEA => "panfs".into(),
|
||||
0x50495045 => "pipefs".into(),
|
||||
0x7C7C6673 => "prl_fs".into(),
|
||||
0x7461_636F => "ocfs2".into(),
|
||||
0x794C_7630 => "overlayfs".into(),
|
||||
0xAAD7_AAEA => "panfs".into(),
|
||||
0x5049_5045 => "pipefs".into(),
|
||||
0x7C7C_6673 => "prl_fs".into(),
|
||||
0x9FA0 => "proc".into(),
|
||||
0x6165676C => "pstorefs".into(),
|
||||
0x6165_676C => "pstorefs".into(),
|
||||
0x002F => "qnx4".into(),
|
||||
0x68191122 => "qnx6".into(),
|
||||
0x858458F6 => "ramfs".into(),
|
||||
0x52654973 => "reiserfs".into(),
|
||||
0x6819_1122 => "qnx6".into(),
|
||||
0x8584_58F6 => "ramfs".into(),
|
||||
0x5265_4973 => "reiserfs".into(),
|
||||
0x7275 => "romfs".into(),
|
||||
0x67596969 => "rpc_pipefs".into(),
|
||||
0x73636673 => "securityfs".into(),
|
||||
0xF97CFF8C => "selinux".into(),
|
||||
0x43415D53 => "smackfs".into(),
|
||||
0x6759_6969 => "rpc_pipefs".into(),
|
||||
0x7363_6673 => "securityfs".into(),
|
||||
0xF97C_FF8C => "selinux".into(),
|
||||
0x4341_5D53 => "smackfs".into(),
|
||||
0x517B => "smb".into(),
|
||||
0xFE534D42 => "smb2".into(),
|
||||
0xBEEFDEAD => "snfs".into(),
|
||||
0x534F434B => "sockfs".into(),
|
||||
0x73717368 => "squashfs".into(),
|
||||
0x62656572 => "sysfs".into(),
|
||||
0x012FF7B6 => "sysv2".into(),
|
||||
0x012FF7B5 => "sysv4".into(),
|
||||
0x01021994 => "tmpfs".into(),
|
||||
0x74726163 => "tracefs".into(),
|
||||
0x24051905 => "ubifs".into(),
|
||||
0x15013346 => "udf".into(),
|
||||
0x00011954 => "ufs".into(),
|
||||
0x54190100 => "ufs".into(),
|
||||
0xFE53_4D42 => "smb2".into(),
|
||||
0xBEEF_DEAD => "snfs".into(),
|
||||
0x534F_434B => "sockfs".into(),
|
||||
0x7371_7368 => "squashfs".into(),
|
||||
0x6265_6572 => "sysfs".into(),
|
||||
0x012F_F7B6 => "sysv2".into(),
|
||||
0x012F_F7B5 => "sysv4".into(),
|
||||
0x0102_1994 => "tmpfs".into(),
|
||||
0x7472_6163 => "tracefs".into(),
|
||||
0x2405_1905 => "ubifs".into(),
|
||||
0x1501_3346 => "udf".into(),
|
||||
0x0001_1954 => "ufs".into(),
|
||||
0x5419_0100 => "ufs".into(),
|
||||
0x9FA2 => "usbdevfs".into(),
|
||||
0x01021997 => "v9fs".into(),
|
||||
0xBACBACBC => "vmhgfs".into(),
|
||||
0xA501FCF5 => "vxfs".into(),
|
||||
0x565A4653 => "vzfs".into(),
|
||||
0x53464846 => "wslfs".into(),
|
||||
0xABBA1974 => "xenfs".into(),
|
||||
0x012FF7B4 => "xenix".into(),
|
||||
0x58465342 => "xfs".into(),
|
||||
0x012FD16D => "xia".into(),
|
||||
0x2FC12FC1 => "zfs".into(),
|
||||
0x0102_1997 => "v9fs".into(),
|
||||
0xBACB_ACBC => "vmhgfs".into(),
|
||||
0xA501_FCF5 => "vxfs".into(),
|
||||
0x565A_4653 => "vzfs".into(),
|
||||
0x5346_4846 => "wslfs".into(),
|
||||
0xABBA_1974 => "xenfs".into(),
|
||||
0x012F_F7B4 => "xenix".into(),
|
||||
0x5846_5342 => "xfs".into(),
|
||||
0x012F_D16D => "xia".into(),
|
||||
0x2FC1_2FC1 => "zfs".into(),
|
||||
other => format!("UNKNOWN ({:#x})", other).into(),
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue