Clippy super strict

This commit is contained in:
Daniel Flanagan 2023-10-27 11:37:26 -05:00
parent ee631e8f18
commit 6c79aef18c
Signed by: lytedev
GPG key ID: 5B2020A0F9921EF4
3 changed files with 39 additions and 3 deletions

View file

@ -24,6 +24,7 @@
formatter = nixpkgs.legacyPackages.${system}.alejandra;
checks = {
inherit (self.packages.${system}) default;
# TODO: clippy
};
devShell = with pkgs;
mkShell {

View file

@ -1,7 +1,10 @@
# Learn Rust in a Month of Lunches
Bought [this book][book] and this code contains my musings and other stuff that
I write as I work through it.
I write as I work through it. I'm already familiar with a few aspects of Rust
and maintain a widely-deployed Rust project at work, so will be focusing on
stuff new and/or interesting to me and mostly ignoring anything that I believe
I'm familiar with -- correctly or not.
Enjoy!

View file

@ -1,11 +1,43 @@
#![warn(
clippy::all,
clippy::style,
clippy::absolute_paths,
clippy::pedantic,
clippy::nursery,
// clippy::cargo
)]
//! my code and notes from the book "Learn Rust in a Month of Lunches"
/// a doc comment - use `cargo doc --open` to see it?
fn main() {
// ch 1
let c: char = '\u{D1EA}';
let bytes = b"yoyoyo";
let me = "meeeeeeeeeeeeeeeeeeeeeeeeeee";
println!("Hello, world! {c}");
// ch 2
let bytes = b"yoyoyo";
println!("Hello, bytes! {bytes:?}");
let me = "meeeeeeeeeeeeeeeeeeeeeeeeeee";
println!("Hello, {me: <4.12}, meet the real {me}.");
// ch 3
let children = 5;
let married = true;
// match guards
match (children, married) {
(children, married) if !married => {
println!("Not married with {children} kids");
}
(children, married) if children == 0 && married => {
println!("Married but no children");
}
_ => {
println!("Married? {married}. Number of children: {children}.");
}
}
}
// if I were to write a webapp, I would like to avoid postgres