diff --git a/Cargo.toml b/Cargo.toml index 6004a36..5cc9431 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,9 +6,18 @@ license = "MIT" [dependencies] +[lints.rust] +unsafe_code = "forbid" + [lints.clippy] all = { level = "warn", priority = -1 } pedantic = { level = "warn", priority = -1 } allow_attributes_without_reason = "warn" cognitive_complexity = "warn" excessive_nesting = "warn" +dbg_macro = "deny" +todo = "deny" +unimplemented = "deny" +unwrap_used = "deny" +indexing_slicing = "deny" +expect_used = "deny" diff --git a/clippy.toml b/clippy.toml index a1a18f9..aef6df2 100644 --- a/clippy.toml +++ b/clippy.toml @@ -1,3 +1,6 @@ too-many-arguments-threshold = 3 excessive-nesting-threshold = 2 cognitive-complexity-threshold = 15 +allow-unwrap-in-tests = true +allow-expect-in-tests = true +allow-indexing-slicing-in-tests = true diff --git a/src/main.rs b/src/main.rs index 7546a57..a120fb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,11 +1,17 @@ fn main() { - println!("Hello, world!"); + println!("{}", greeting()); +} + +fn greeting() -> &'static str { + "Hello, world!" } #[cfg(test)] mod tests { + use super::greeting; + #[test] - fn it_works() { - assert!(true); + fn greeting_is_hello_world() { + assert_eq!(greeting(), "Hello, world!"); } }