Skip to content

Commit 9c502c9

Browse files
committed
Update lints
Signed-off-by: Maxime Ripard <mripard@kernel.org>
1 parent b70cbb5 commit 9c502c9

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

.rustfmt.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
unstable_features = true
22

33
comment_width = 100
4+
group_imports = "StdExternalCrate"
5+
imports_granularity = "Crate"
6+
style_edition = "2024"
47
wrap_comments = true

Cargo.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ nightly = []
2222
[lints.rust]
2323
# Groups
2424
future_incompatible = { level = "warn", priority = -1 }
25+
keyword_idents = { level = "warn", priority = -1 }
2526
nonstandard_style = { level = "warn", priority = -1 }
2627
rust_2018_idioms = { level = "warn", priority = -1 }
2728

2829
# Individual Lints
2930
absolute_paths_not_starting_with_crate = "warn"
30-
keyword_idents = "warn"
3131
let_underscore_drop = "warn"
3232
macro_use_extern_crate = "warn"
3333
missing_abi = "deny"
@@ -42,7 +42,7 @@ single_use_lifetimes = "warn"
4242
trivial_casts = "warn"
4343
trivial_numeric_casts = "warn"
4444
unreachable_pub = "warn"
45-
# unsafe_code = "deny"
45+
unsafe_code = "deny"
4646
unsafe_op_in_unsafe_fn = "warn"
4747
unused_crate_dependencies = "warn"
4848
unused_import_braces = "warn"
@@ -65,6 +65,7 @@ suspicious = { level = "warn", priority = -1 }
6565
# Individual Lints
6666
## Restriction Clippy Lints
6767
alloc_instead_of_core = "warn"
68+
as_pointer_underscore = "warn"
6869
assertions_on_result_states = "warn"
6970
dbg_macro = "warn"
7071
decimal_literal_representation = "warn"
@@ -79,6 +80,7 @@ get_unwrap = "warn"
7980
infinite_loop = "warn"
8081
let_underscore_must_use = "warn"
8182
let_underscore_untyped = "warn"
83+
literal_string_with_formatting_args = "warn"
8284
lossy_float_literal = "warn"
8385
map_err_ignore = "warn"
8486
mem_forget = "warn"
@@ -92,8 +94,10 @@ multiple_unsafe_ops_per_block = "warn"
9294
mutex_atomic = "warn"
9395
needless_raw_strings = "warn"
9496
non_ascii_literal = "warn"
97+
non_zero_suggestions = "warn"
9598
panic_in_result_fn = "warn"
9699
partial_pub_fields = "warn"
100+
pathbuf_init_then_push = "warn"
97101
print_stdout = "warn"
98102
redundant_type_annotations = "warn"
99103
ref_patterns = "warn"
@@ -115,6 +119,8 @@ unnecessary_safety_comment = "warn"
115119
unnecessary_safety_doc = "warn"
116120
unnecessary_self_imports = "warn"
117121
unneeded_field_pattern = "warn"
122+
unused_result_ok = "warn"
123+
unused_trait_names = "warn"
118124
unwrap_in_result = "warn"
119125
unwrap_used = "warn"
120126
use_debug = "warn"

src/ioctl.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
use std::{
22
io,
3-
os::fd::{BorrowedFd, FromRawFd, OwnedFd, RawFd},
3+
os::fd::{BorrowedFd, FromRawFd as _, OwnedFd, RawFd},
44
};
55

66
use rustix::{
77
fs::OFlags,
88
io::Errno,
9-
ioctl::{ioctl, opcode, Updater},
9+
ioctl::{Updater, ioctl, opcode},
1010
};
1111

1212
use crate::{HeapError, Result};
@@ -32,7 +32,8 @@ fn dma_heap_alloc_ioctl(
3232
) -> core::result::Result<(), Errno> {
3333
// SAFETY: This function is unsafe because the opcode has to be valid, and the value type must
3434
// match. We have checked those, so we're good.
35-
let ioctl_type = unsafe { Updater::<DMA_HEAP_IOC_ALLOC_OPCODE, dma_heap_allocation_data>::new(data) };
35+
let ioctl_type =
36+
unsafe { Updater::<DMA_HEAP_IOC_ALLOC_OPCODE, dma_heap_allocation_data>::new(data) };
3637

3738
// SAFETY: This function is unsafe because the driver isn't guaranteed to implement the ioctl,
3839
// and to implement it properly. We don't have much of a choice and still have to trust the

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
)
2222
)]
2323
#![doc = include_str!("../README.md")]
24+
#![allow(unsafe_code)]
2425

2526
use std::{
2627
fs::File,
27-
os::{fd::AsFd, unix::io::OwnedFd},
28+
os::{fd::AsFd as _, unix::io::OwnedFd},
2829
path::PathBuf,
2930
};
3031

3132
mod ioctl;
3233
use ioctl::dma_heap_alloc;
33-
3434
use log::debug;
3535
use strum_macros::Display;
3636

0 commit comments

Comments
 (0)