From 8506a231dd076358dd0ae0c51b93907060333c62 Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 4 Dec 2024 17:14:15 +0100 Subject: [PATCH] Add more lints --- Cargo.toml | 22 ++++++++++++++++++++++ examples/testbot_commands.rs | 2 ++ examples/testbot_instance.rs | 1 + examples/testbot_instances.rs | 1 + examples/testbot_manual.rs | 1 + src/lib.rs | 11 ----------- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3a44b76..917f0b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,3 +40,25 @@ required-features = ["bot"] [[example]] name = "testbot_commands" required-features = ["bot"] + +[lints] +rust.unsafe_code = { level = "forbid", priority = 1 } +# Lint groups +rust.deprecated_safe = "warn" +rust.future_incompatible = "warn" +rust.keyword_idents = "warn" +rust.rust_2018_idioms = "warn" +rust.unused = "warn" +# Individual lints +rust.non_local_definitions = "warn" +rust.redundant_imports = "warn" +rust.redundant_lifetimes = "warn" +rust.single_use_lifetimes = "warn" +rust.unit_bindings = "warn" +rust.unnameable_types = "warn" +rust.unused_crate_dependencies = "warn" +rust.unused_import_braces = "warn" +rust.unused_lifetimes = "warn" +rust.unused_qualifications = "warn" +# Clippy +clippy.use_self = "warn" diff --git a/examples/testbot_commands.rs b/examples/testbot_commands.rs index bacab89..f6d184a 100644 --- a/examples/testbot_commands.rs +++ b/examples/testbot_commands.rs @@ -1,3 +1,5 @@ +#![allow(unused_crate_dependencies)] + // TODO Add description // TODO Clean up and unify test bots diff --git a/examples/testbot_instance.rs b/examples/testbot_instance.rs index c1c2895..f748429 100644 --- a/examples/testbot_instance.rs +++ b/examples/testbot_instance.rs @@ -1,5 +1,6 @@ //! Similar to the `testbot_manual` example, but using [`Instance`] to connect //! to the room (and to reconnect). +#![allow(unused_crate_dependencies)] use euphoxide::api::packet::ParsedPacket; use euphoxide::api::{Data, Nick, Send}; diff --git a/examples/testbot_instances.rs b/examples/testbot_instances.rs index d44cbe7..2ad134b 100644 --- a/examples/testbot_instances.rs +++ b/examples/testbot_instances.rs @@ -1,5 +1,6 @@ //! Similar to the `testbot_manual` example, but using [`Instance`] to connect //! to the room (and to reconnect). +#![allow(unused_crate_dependencies)] use euphoxide::api::packet::ParsedPacket; use euphoxide::api::{Data, Nick, Send}; diff --git a/examples/testbot_manual.rs b/examples/testbot_manual.rs index d6535a4..71a7280 100644 --- a/examples/testbot_manual.rs +++ b/examples/testbot_manual.rs @@ -1,5 +1,6 @@ //! A small bot that doesn't use the `bot` submodule. Meant to show how the main //! parts of the API fit together. +#![allow(unused_crate_dependencies)] use std::error::Error; use std::time::Duration; diff --git a/src/lib.rs b/src/lib.rs index 66fb34e..380b321 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,14 +1,3 @@ -#![forbid(unsafe_code)] -// Rustc lint groups -#![warn(future_incompatible)] -#![warn(rust_2018_idioms)] -#![warn(unused)] -// Rustc lints -#![warn(noop_method_call)] -#![warn(single_use_lifetimes)] -// Clippy lints -#![warn(clippy::use_self)] - pub mod api; #[cfg(feature = "bot")] pub mod bot;