Skip to content

Commit abffd73

Browse files
committed
make clippy::pedantic the default and enforce checks on panic sites
1 parent 4cec3e0 commit abffd73

6 files changed

Lines changed: 28 additions & 1 deletion

File tree

Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,23 @@ codegen-units = 1
3737

3838
#═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
3939

40+
[lints.rust]
41+
unsafe_code = "forbid"
42+
43+
[lints.clippy]
44+
pedantic = { level = "warn", priority = -1 }
45+
unwrap_used = "warn"
46+
expect_used = "warn"
47+
panic = "warn"
48+
todo = "warn"
49+
unimplemented = "warn"
50+
unreachable = "warn"
51+
dbg_macro = "warn"
52+
print_stdout = "warn"
53+
print_stderr = "warn"
54+
55+
#═══════════════════════════════════════════════════════════════════════════════════════════════════════════════════════
56+
4057
[dependencies]
4158
async-channel = "2.5.0"
4259
clap = { version = "4.6.5", features = ["derive"] }

build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::unwrap_used, clippy::panic)]
2+
13
#[cfg(windows)]
24
extern crate winresource;
35

src/cli/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub(crate) struct Args {
3131

3232
impl Args {
3333
/// Handle and return CLI arguments
34+
#[allow(clippy::print_stdout, clippy::print_stderr)]
3435
pub fn handle() -> Self {
3536
let args = Args::parse();
3637

src/networking/types/bogon.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::unwrap_used)]
2+
13
use ipnet::IpNet;
24
use std::net::IpAddr;
35

src/utils/error_logger.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@ pub trait ErrorLogger<T, E> {
88
}
99

1010
impl<T, E: Display> ErrorLogger<T, E> for Result<T, E> {
11+
#[allow(clippy::print_stderr)]
1112
fn log_err(self, location: Location) -> Result<T, E> {
1213
if let Err(e) = &self {
1314
let file = location.file;
1415
let line = location.line;
1516
eprintln!("Sniffnet error at [{file}:{line}]: {e}");
1617
// in debug mode, panic on error
1718
#[cfg(debug_assertions)]
18-
panic!();
19+
#[allow(clippy::panic)]
20+
{
21+
panic!();
22+
}
1923
}
2024

2125
self

src/utils/formatted_strings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
2020
// }
2121
// }
2222

23+
#[allow(clippy::print_stdout)]
2324
pub fn print_cli_welcome_message() {
2425
let ver = APP_VERSION;
2526
print!(

0 commit comments

Comments
 (0)