Skip to content

Commit 3f338d8

Browse files
authored
Fix miscellaneous clippy lints. (#893)
* Fix miscellaneous clippy lints. * Fix unused import warnings.
1 parent e2314b7 commit 3f338d8

File tree

18 files changed

+69
-96
lines changed

18 files changed

+69
-96
lines changed

src/backend/libc/mount/types.rs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ bitflags! {
9292
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
9393
pub struct FsOpenFlags: c::c_uint {
9494
/// `FSOPEN_CLOEXEC`
95-
const FSOPEN_CLOEXEC = 0x00000001;
95+
const FSOPEN_CLOEXEC = 0x0000_0001;
9696

9797
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
9898
const _ = !0;
@@ -109,7 +109,7 @@ bitflags! {
109109
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
110110
pub struct FsMountFlags: c::c_uint {
111111
/// `FSMOUNT_CLOEXEC`
112-
const FSMOUNT_CLOEXEC = 0x00000001;
112+
const FSMOUNT_CLOEXEC = 0x0000_0001;
113113

114114
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
115115
const _ = !0;
@@ -157,37 +157,37 @@ bitflags! {
157157
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
158158
pub struct MountAttrFlags: c::c_uint {
159159
/// `MOUNT_ATTR_RDONLY`
160-
const MOUNT_ATTR_RDONLY = 0x00000001;
160+
const MOUNT_ATTR_RDONLY = 0x0000_0001;
161161

162162
/// `MOUNT_ATTR_NOSUID`
163-
const MOUNT_ATTR_NOSUID = 0x00000002;
163+
const MOUNT_ATTR_NOSUID = 0x0000_0002;
164164

165165
/// `MOUNT_ATTR_NODEV`
166-
const MOUNT_ATTR_NODEV = 0x00000004;
166+
const MOUNT_ATTR_NODEV = 0x0000_0004;
167167

168168
/// `MOUNT_ATTR_NOEXEC`
169-
const MOUNT_ATTR_NOEXEC = 0x00000008;
169+
const MOUNT_ATTR_NOEXEC = 0x0000_0008;
170170

171171
/// `MOUNT_ATTR__ATIME`
172-
const MOUNT_ATTR__ATIME = 0x00000070;
172+
const MOUNT_ATTR__ATIME = 0x0000_0070;
173173

174174
/// `MOUNT_ATTR_RELATIME`
175-
const MOUNT_ATTR_RELATIME = 0x00000000;
175+
const MOUNT_ATTR_RELATIME = 0x0000_0000;
176176

177177
/// `MOUNT_ATTR_NOATIME`
178-
const MOUNT_ATTR_NOATIME = 0x00000010;
178+
const MOUNT_ATTR_NOATIME = 0x0000_0010;
179179

180180
/// `MOUNT_ATTR_STRICTATIME`
181-
const MOUNT_ATTR_STRICTATIME = 0x00000020;
181+
const MOUNT_ATTR_STRICTATIME = 0x0000_0020;
182182

183183
/// `MOUNT_ATTR_NODIRATIME`
184-
const MOUNT_ATTR_NODIRATIME = 0x00000080;
184+
const MOUNT_ATTR_NODIRATIME = 0x0000_0080;
185185

186186
/// `MOUNT_ATTR_NOUSER`
187-
const MOUNT_ATTR_IDMAP = 0x00100000;
187+
const MOUNT_ATTR_IDMAP = 0x0010_0000;
188188

189189
/// `MOUNT_ATTR__ATIME_FLAGS`
190-
const MOUNT_ATTR_NOSYMFOLLOW = 0x00200000;
190+
const MOUNT_ATTR_NOSYMFOLLOW = 0x0020_0000;
191191

192192
/// `MOUNT_ATTR__ATIME_FLAGS`
193193
const MOUNT_ATTR_SIZE_VER0 = 32;
@@ -207,32 +207,32 @@ bitflags! {
207207
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
208208
pub struct MoveMountFlags: c::c_uint {
209209
/// `MOVE_MOUNT_F_EMPTY_PATH`
210-
const MOVE_MOUNT_F_SYMLINKS = 0x00000001;
210+
const MOVE_MOUNT_F_SYMLINKS = 0x0000_0001;
211211

212212
/// `MOVE_MOUNT_F_AUTOMOUNTS`
213-
const MOVE_MOUNT_F_AUTOMOUNTS = 0x00000002;
213+
const MOVE_MOUNT_F_AUTOMOUNTS = 0x0000_0002;
214214

215215
/// `MOVE_MOUNT_F_EMPTY_PATH`
216-
const MOVE_MOUNT_F_EMPTY_PATH = 0x00000004;
216+
const MOVE_MOUNT_F_EMPTY_PATH = 0x0000_0004;
217217

218218
/// `MOVE_MOUNT_T_SYMLINKS`
219-
const MOVE_MOUNT_T_SYMLINKS = 0x00000010;
219+
const MOVE_MOUNT_T_SYMLINKS = 0x0000_0010;
220220

221221
/// `MOVE_MOUNT_T_AUTOMOUNTS`
222-
const MOVE_MOUNT_T_AUTOMOUNTS = 0x00000020;
222+
const MOVE_MOUNT_T_AUTOMOUNTS = 0x0000_0020;
223223

224224
/// `MOVE_MOUNT_T_EMPTY_PATH`
225-
const MOVE_MOUNT_T_EMPTY_PATH = 0x00000040;
225+
const MOVE_MOUNT_T_EMPTY_PATH = 0x0000_0040;
226226

227227
/// `MOVE_MOUNT__MASK`
228-
const MOVE_MOUNT_SET_GROUP = 0x00000100;
228+
const MOVE_MOUNT_SET_GROUP = 0x0000_0100;
229229

230230
// TODO: add when linux 6.5 is released
231231
// /// `MOVE_MOUNT_BENEATH`
232-
// const MOVE_MOUNT_BENEATH = 0x00000200;
232+
// const MOVE_MOUNT_BENEATH = 0x0000_0200;
233233

234234
/// `MOVE_MOUNT__MASK`
235-
const MOVE_MOUNT__MASK = 0x00000377;
235+
const MOVE_MOUNT__MASK = 0x0000_0377;
236236

237237
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
238238
const _ = !0;
@@ -281,16 +281,16 @@ bitflags! {
281281
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
282282
pub struct FsPickFlags: c::c_uint {
283283
/// `FSPICK_CLOEXEC`
284-
const FSPICK_CLOEXEC = 0x00000001;
284+
const FSPICK_CLOEXEC = 0x0000_0001;
285285

286286
/// `FSPICK_SYMLINK_NOFOLLOW`
287-
const FSPICK_SYMLINK_NOFOLLOW = 0x00000002;
287+
const FSPICK_SYMLINK_NOFOLLOW = 0x0000_0002;
288288

289289
/// `FSPICK_NO_AUTOMOUNT`
290-
const FSPICK_NO_AUTOMOUNT = 0x00000004;
290+
const FSPICK_NO_AUTOMOUNT = 0x0000_0004;
291291

292292
/// `FSPICK_EMPTY_PATH`
293-
const FSPICK_EMPTY_PATH = 0x00000008;
293+
const FSPICK_EMPTY_PATH = 0x0000_0008;
294294

295295
/// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
296296
const _ = !0;

src/backend/libc/termios/syscalls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ pub(crate) fn tcsetattr(
144144
// linux-raw-sys' ioctl-generation script for sparc isn't working yet,
145145
// so as a temporary workaround, declare these manually.
146146
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
147-
const TCSETS: u32 = 0x80245409;
147+
const TCSETS: u32 = 0x8024_5409;
148148
#[cfg(any(target_arch = "sparc", target_arch = "sparc64"))]
149-
const TCSETS2: u32 = 0x802c540d;
149+
const TCSETS2: u32 = 0x802c_540d;
150150

151151
// Translate from `optional_actions` into an ioctl request code. On
152152
// MIPS, `optional_actions` already has `TCGETS` added to it.

src/backend/linux_raw/param/auxv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static ENTRY: AtomicUsize = AtomicUsize::new(0);
165165
#[cfg(feature = "alloc")]
166166
fn pr_get_auxv() -> crate::io::Result<Vec<u8>> {
167167
use super::super::conv::{c_int, pass_usize, ret_usize};
168-
const PR_GET_AUXV: c::c_int = 0x41555856;
168+
const PR_GET_AUXV: c::c_int = 0x4155_5856;
169169
let mut buffer = alloc::vec![0u8; 512];
170170
let len = unsafe {
171171
ret_usize(syscall_always_asm!(

src/fs/at.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ use crate::fs::Access;
1212
use crate::fs::AtFlags;
1313
#[cfg(apple)]
1414
use crate::fs::CloneFlags;
15-
#[cfg(not(any(apple, target_os = "espidf", target_os = "vita", target_os = "wasi")))]
16-
use crate::fs::FileType;
1715
#[cfg(linux_kernel)]
1816
use crate::fs::RenameFlags;
1917
#[cfg(not(any(target_os = "aix", target_os = "espidf")))]
2018
use crate::fs::Stat;
19+
#[cfg(not(any(apple, target_os = "espidf", target_os = "vita", target_os = "wasi")))]
20+
use crate::fs::{Dev, FileType};
2121
#[cfg(not(any(target_os = "espidf", target_os = "wasi")))]
2222
use crate::fs::{Gid, Uid};
2323
use crate::fs::{Mode, OFlags};
@@ -33,8 +33,6 @@ use {
3333
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
3434
use {crate::fs::Timestamps, crate::timespec::Nsecs};
3535

36-
pub use backend::fs::types::{Dev, RawMode};
37-
3836
/// `UTIME_NOW` for use with [`utimensat`].
3937
///
4038
/// [`utimensat`]: crate::fs::utimensat

src/fs/constants.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,5 @@
33
use crate::backend;
44

55
pub use crate::io::FdFlags;
6-
#[cfg(not(any(target_os = "espidf", target_os = "vita")))]
7-
pub use backend::fs::types::Access;
8-
pub use backend::fs::types::{Dev, Mode, OFlags};
9-
10-
#[cfg(not(any(target_os = "espidf", target_os = "redox")))]
11-
pub use backend::fs::types::AtFlags;
12-
13-
#[cfg(apple)]
14-
pub use backend::fs::types::{CloneFlags, CopyfileFlags};
15-
16-
#[cfg(linux_kernel)]
17-
pub use backend::fs::types::*;
18-
196
pub use crate::timespec::{Nsecs, Secs, Timespec};
7+
pub use backend::fs::types::*;

src/fs/fadvise.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::{backend, io};
22
use backend::fd::AsFd;
3-
4-
pub use backend::fs::types::Advice;
3+
use backend::fs::types::Advice;
54

65
/// `posix_fadvise(fd, offset, len, advice)`—Declares an expected access
76
/// pattern for a file.

src/fs/fcntl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn fcntl_get_seals<Fd: AsFd>(fd: Fd) -> io::Result<SealFlags> {
6565
}
6666

6767
#[cfg(any(linux_kernel, target_os = "freebsd", target_os = "fuchsia"))]
68-
pub use backend::fs::types::SealFlags;
68+
use backend::fs::types::SealFlags;
6969

7070
/// `fcntl(fd, F_ADD_SEALS)`
7171
///

src/fs/fcopyfile.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use crate::fs::CopyfileFlags;
22
use crate::{backend, io};
33
use backend::fd::AsFd;
4-
5-
/// `copyfile_state_t`
6-
pub use backend::fs::types::copyfile_state_t;
4+
use backend::fs::types::copyfile_state_t;
75

86
/// `fcopyfile(from, to, state, flags)`
97
///

src/fs/fd.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ use crate::fs::{Gid, Uid};
77
use crate::fs::{OFlags, SeekFrom, Timespec};
88
use crate::{backend, io};
99
use backend::fd::{AsFd, BorrowedFd};
10-
11-
#[cfg(not(any(target_os = "espidf", target_os = "vita", target_os = "wasi")))]
12-
pub use backend::fs::types::FlockOperation;
13-
1410
#[cfg(not(any(
1511
netbsdlike,
1612
solarish,
@@ -21,10 +17,17 @@ pub use backend::fs::types::FlockOperation;
2117
target_os = "redox",
2218
target_os = "vita",
2319
)))]
24-
pub use backend::fs::types::FallocateFlags;
25-
26-
pub use backend::fs::types::Stat;
27-
20+
use backend::fs::types::FallocateFlags;
21+
#[cfg(not(any(
22+
target_os = "espidf",
23+
target_os = "solaris",
24+
target_os = "vita",
25+
target_os = "wasi"
26+
)))]
27+
use backend::fs::types::FlockOperation;
28+
#[cfg(linux_kernel)]
29+
use backend::fs::types::FsWord;
30+
use backend::fs::types::Stat;
2831
#[cfg(not(any(
2932
solarish,
3033
target_os = "espidf",
@@ -35,13 +38,9 @@ pub use backend::fs::types::Stat;
3538
target_os = "vita",
3639
target_os = "wasi",
3740
)))]
38-
pub use backend::fs::types::StatFs;
39-
41+
use backend::fs::types::StatFs;
4042
#[cfg(not(any(target_os = "haiku", target_os = "redox", target_os = "wasi")))]
41-
pub use backend::fs::types::{StatVfs, StatVfsMountFlags};
42-
43-
#[cfg(linux_kernel)]
44-
pub use backend::fs::types::FsWord;
43+
use backend::fs::types::StatVfs;
4544

4645
/// Timestamps used by [`utimensat`] and [`futimens`].
4746
///

src/fs/file_type.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)