@@ -7,6 +7,15 @@ homepage = "https://github.com/nik-rev/countryfetch"
77description = " A Command-line tool similar to Neofetch for obtaining information about your country"
88license = " MIT OR Apache-2.0"
99
10+ # Our MSRV. We use nightly toolchain for better dev experience, but
11+ # this software must build with at least this version.
12+ #
13+ # More info in the comment in `rust-toolchain.toml`
14+ rust-version = " 1.88"
15+
16+ [lints ]
17+ workspace = true
18+
1019[workspace ]
1120members = [" ." , " generate_country_data" ]
1221default-members = [" ." ]
@@ -56,18 +65,6 @@ inherits = "release"
5665codegen-units = 1
5766lto = true
5867
59- # ============================
60- #
61- # Lints
62- #
63- # - strict set of lints for a
64- # more consistent codebase
65- #
66- # - delegate as much as possible
67- # to automated tooling
68- #
69- # ============================
70-
7168[workspace .lints .rust ]
7269# do not import if its already in scope
7370# e.g. `use std::option::Option::None`
@@ -80,20 +77,36 @@ unused_qualifications = "warn"
8077unused_macro_rules = " warn"
8178# lints against e.g. undefined meta variables
8279meta_variable_misuse = " warn"
83- # all types must `#[derive(Copy)]`
84- missing_copy_implementations = " warn"
85- # all types must `#[derive(Debug)]`
86- missing_debug_implementations = " warn"
8780
8881[workspace .lints .clippy ]
8982pedantic = { priority = -1 , level = " warn" }
9083
84+ # --- allowed lints
85+ #
86+ # `$a * $b + $c` is slower and less precise than `$a.mul_add($b, $c)`
87+ # but it is more readable, the gain in speed / precision
88+ # will be negligible in most situations
89+ suboptimal_flops = " allow"
90+ # arbitrary limit imposes unnecessary
91+ # restriction and can make code harder to follow
92+ too_many_lines = " allow"
93+ # if we need it const, make it const.
94+ # no need to make everything that can be const, const
95+ missing_const_for_fn = " allow"
96+ # Too verbose.
97+ missing_errors_doc = " allow"
98+ # ---
99+
100+ # We use nightly Rust toolchain but want to guarantee that we
101+ # can build with a stable Rust compiler.
102+ #
103+ # See `rust-toolchain.toml` for more info.
104+ incompatible_msrv = " deny"
105+
91106# --- more consistent ways of writing code
92107#
93108# `if $a { Some($b) } else { None }` => `$a.then(|| $b)`
94109if_then_some_else_none = " warn"
95- # `use Trait` => `use Trait as _`
96- unused_trait_names = " warn"
97110# `foo.rs` => `foo/mod.rs`
98111self_named_module_files = " warn"
99112# omit `test_` prefix in tests: `fn test_foo` => `fn foo`
@@ -135,6 +148,8 @@ multiple_unsafe_ops_per_block = "warn"
135148
136149# --- explain more things
137150#
151+ # `#[allow]` => `#[expect]`
152+ allow_attributes = " warn"
138153# `#[allow]` => `#[allow, reason = "why"]`
139154allow_attributes_without_reason = " warn"
140155# `unsafe` blocks need a `SAFETY:` comment
@@ -159,34 +174,17 @@ dbg_macro = "warn"
159174todo = " warn"
160175use_debug = " warn"
161176unimplemented = " warn"
162- # explicitly `#[allow]` functions to print to stdout
177+ # must explicitly `#[allow]` functions to print to stdout
163178print_stdout = " warn"
164- # explicitly `#[allow]` functions to print to stderr
179+ # must explicitly `#[allow]` functions to print to stderr
165180print_stderr = " warn"
166181# ---
167182
168183# --- prevent bugs
169- # new variants added by libraries become errors
170- # instead of being silently ignored
171- wildcard_enum_match_arm = " warn"
172184# if function and trait provide method of same name, it is confusing
173185same_name_method = " warn"
174186# `create_dir(...)` => `create_dir_all(...)`
175187# usually, failing when dir already exists is
176188# not what we want
177189create_dir = " warn"
178190# ---
179-
180- # --- allowed lints
181- #
182- # `$a * $b + $c` is slower and less precise than `$a.mul_add($b, $c)`
183- # but it is more readable, the gain in speed / precision
184- # will be negligible in most situations
185- suboptimal_flops = " allow"
186- # arbitrary limit imposes unnecessary
187- # restriction and can make code harder to follow
188- too_many_lines = " allow"
189- # if we need it const, make it const.
190- # no need to make everything that can be const, const
191- missing_const_for_fn = " allow"
192- # ---
0 commit comments