-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCargo.toml
More file actions
439 lines (321 loc) · 13 KB
/
Cargo.toml
File metadata and controls
439 lines (321 loc) · 13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
# SPDX-FileCopyrightText: Copyright © 2025 hashcatHitman
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
[package]
name = "rust_project_template"
version = "0.1.0"
edition = "2024"
rust-version = "1.89.0"
description = """
A base for me to use as the starting point of my projects written in Rust.
"""
readme = "README.md"
repository = "https://github.com/hashcatHitman/rust_project_template"
license = "Apache-2.0 OR MIT"
keywords = ["project-template"]
categories = ["rust-patterns", "development-tools"]
publish = false
[profile.release]
codegen-units = 1
strip = true
opt-level = 3
debug = false
lto = true
incremental = false
[profile.release.package."*"]
codegen-units = 1
strip = true
opt-level = 3
debug = false
incremental = false
[profile.release.build-override]
codegen-units = 1
strip = true
opt-level = 3
debug = false
incremental = false
[lints.rust]
# Unsafe code
unsafe_code = "forbid"
deprecated_safe_2024 = "forbid"
missing_unsafe_on_extern = "forbid"
unsafe_attr_outside_unsafe = "forbid"
unsafe_op_in_unsafe_fn = "forbid"
# Casting integers to pointers messes with provenance
fuzzy_provenance_casts = "warn" # unstable; #130351
# Casting pointers to integers loses with provenance
lossy_provenance_casts = "warn" # unstable; #130351
# I don't like ambiguity
ambiguous_negative_literals = "warn"
# This should be an async closure instead
closure_returning_async_block = "warn"
# These are shadowed since 1.86.0
deref_into_dyn_supertrait = "warn"
# I forbid lints on purpose. I will deal with breakage if it appears.
forbidden_lint_groups = "allow"
# Unnecessary lifetime bounds add clutter, complexity, and may be a sign of user
# error
explicit_outlives_requirements = "warn"
impl_trait_redundant_captures = "warn"
redundant_lifetimes = "warn"
single_use_lifetimes = "warn"
unused_lifetimes = "warn"
# Drops like this are unexpected
if_let_rescope = "warn"
let_underscore_drop = "warn"
# Can lead to overzealous borrowck
impl_trait_overcaptures = "warn"
# Whatever edition I'm using, I'd rather avoid using future keywords
keyword_idents_2018 = "warn"
keyword_idents_2024 = "warn"
# Messy
absolute_paths_not_starting_with_crate = "warn"
macro_use_extern_crate = "warn"
redundant_imports = "warn"
unused_crate_dependencies = "warn"
unused_extern_crates = "warn"
unused_import_braces = "warn"
unused_qualifications = "warn"
# Can have false positives, but can also help write better macros
meta_variable_misuse = "warn"
# I like implementing traits when I can, usually
missing_copy_implementations = "warn"
missing_debug_implementations = "warn"
# Documentation is good to have
missing_docs = "warn"
# Adds overhead. Is it worth it?
multiple_supertrait_upcastable = "warn" # unstable; #150833
# Causes problems in async
must_not_suspend = "warn" # unstable; #83310
# I don't write non-ascii characters. If these show up, it's a security problem.
non_ascii_idents = "forbid"
# Explicit matches are preferred
non_exhaustive_omitted_patterns = "warn" # unstable; #89554
# Shadowing silently leads to unexpected behavior
shadowing_supertrait_items = "warn" # unstable; #89151
resolving_to_items_shadowing_supertrait_items = "warn" # unstable; #89151
# Casting can be dangerous, I'd rather not if I don't need to
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unreachable_pub = "warn"
# This probably means I made a mistake
unit_bindings = "warn"
unnameable_types = "warn"
unused_macro_rules = "warn"
unused_results = "warn"
# Explicitness provides clarity, and this assists import grouping in rustfmt
unqualified_local_imports = "warn" # unstable; #138299
# This is an easy way to accidently tank performance. Check!
variant_size_differences = "warn"
[lints.clippy]
# "code that is outright wrong or useless"
correctness = "forbid"
# "code that is most likely wrong or useless"
suspicious = "warn"
# "code that does something simple but in a complex way"
complexity = "warn"
# "code that can be written to run faster"
perf = "warn"
# "code that should be written in a more idiomatic way"
style = "warn"
# I tend to find these useful. I can always `expect` false positives.
pedantic = "warn"
# "lints for the cargo manifest"
cargo = "warn"
# I find this annoying.
must_use_candidate = { level = "allow", priority = 1 }
# New lints are fun! They tend to work well enough.
nursery = "warn"
# I find this annoying.
redundant_pub_crate = { level = "allow", priority = 1 }
# Restrictions
# This is messy and unidiomatic.
absolute_paths = { level = "warn", priority = 1 }
# When possible, I'd prefer to import from core
alloc_instead_of_core = { level = "warn", priority = 1 }
# If a lint stops firing, I don't want to keep it disabled.
allow_attributes = { level = "warn", priority = 1 }
# Give a reason!
allow_attributes_without_reason = { level = "warn", priority = 1 }
# Overflows and panics are undesirable, prefer explicit handling
arithmetic_side_effects = { level = "warn", priority = 1 }
# This cast can be dangerous.
as_pointer_underscore = { level = "warn", priority = 1 }
as_underscore = { level = "warn", priority = 1 }
# This form of assertion does not show any of the information present in the
# Result other than which variant it isn’t.
assertions_on_result_states = { level = "warn", priority = 1 }
# Can give the false impression of 100% coverage
cfg_not_test = { level = "warn", priority = 1 }
# Obscures the fact that only the pointer is being cloned, not the underlying
# data
clone_on_ref_ptr = { level = "warn", priority = 1 }
# Results in failure when more than one directory needs to be created or when
# the directory already exists
create_dir = { level = "warn", priority = 1 }
# Debugging tool, not to be committed
dbg_macro = { level = "warn", priority = 1 }
# Can improve readability
decimal_literal_representation = { level = "warn", priority = 1 }
# May cause needless recompilation.
doc_include_without_cfg = { level = "warn", priority = 1 }
# I like using punctuation.
doc_paragraphs_missing_punctuation = { level = "warn", priority = 1 }
# MISRA-C:2004 Rule 14.10, explicitness
else_if_without_else = { level = "warn", priority = 1 }
# Prevents destructuring to no other benefit
empty_drop = { level = "warn", priority = 1 }
# Style preference
empty_enum_variants_with_brackets = { level = "warn", priority = 1 }
empty_structs_with_brackets = { level = "warn", priority = 1 }
# Confusing to have 20 "Error"s
error_impl_error = { level = "warn", priority = 1 }
# Don't terminate outside of main.
exit = { level = "warn", priority = 1 }
# Handle errors
expect_used = { level = "warn", priority = 1 }
# Increases area that needs to be checked to maintain invariants
field_scoped_visibility_modifiers = { level = "warn", priority = 1 }
# Tests whether a path is something you can get bytes from. Doesn’t cover
# special file types in unix-like systems, and doesn’t cover symlink in windows.
# Using `!FileType::is_dir()` is a better way in those cases.
filetype_is_file = { level = "warn", priority = 1 }
# https://floating-point-gui.de/errors/comparison/
float_cmp_const = { level = "warn", priority = 1 }
# This is almost definitely a mistake.
fn_to_numeric_cast_any = { level = "warn", priority = 1 }
# This is more concise.
if_then_some_else_none = { level = "warn", priority = 1 }
# Less useful, not turbofish compatible. Use generics.
impl_trait_in_params = { level = "warn", priority = 1 }
# This can panic! Use non-panicking methods instead, OR, justify it.
indexing_slicing = { level = "warn", priority = 1 }
# This is probably a mistake.
infinite_loop = { level = "warn", priority = 1 }
# This might be a mistake. Double check. Remainder is discarded here.
integer_division = { level = "warn", priority = 1 }
# May prefer constant time implementations, and generally prefer explicit floor/
# ceil/euclid/etc method to make sure it works as expected.
integer_division_remainder_used = { level = "warn", priority = 1 }
# Order is undefined. Iterate over keys instead.
iter_over_hash_type = { level = "warn", priority = 1 }
# Might be a mistake.
large_include_file = { level = "warn", priority = 1 }
# Might be a mistake.
let_underscore_must_use = { level = "warn", priority = 1 }
# Can lead to mistakes if left untyped
let_underscore_untyped = { level = "warn", priority = 1 }
# Unexpected precision loss is undesirable
lossy_float_literal = { level = "warn", priority = 1 }
# Original error discarded
map_err_ignore = { level = "warn", priority = 1 }
# Expresses intent better
map_with_unused_argument_over_ranges = { level = "warn", priority = 1 }
# Memory leaks
mem_forget = { level = "warn", priority = 1 }
# Use descriptive names
min_ident_chars = { level = "warn", priority = 1 }
# Explain why it's a problem if it fails
missing_assert_message = { level = "warn", priority = 1 }
# Removes bounds checks
missing_asserts_for_indexing = { level = "warn", priority = 1 }
# Document everything
missing_docs_in_private_items = { level = "warn", priority = 1 }
# Confusing!
mixed_read_write_in_expression = { level = "warn", priority = 1 }
# I don't like the mod.rs style
mod_module_files = { level = "warn", priority = 1 }
# Better names are usually possible
module_name_repetitions = { level = "warn", priority = 1 }
# Generally prefer explicit floor/ ceil/euclid/etc method to make sure it works
# as expected.
modulo_arithmetic = { level = "warn", priority = 1 }
# Keep it all together, easier to review
multiple_inherent_impl = { level = "warn", priority = 1 }
# If you're writing unsafe, justify EVERY operation.
multiple_unsafe_ops_per_block = { level = "forbid", priority = 1 }
# Mutex is overkill
mutex_atomic = { level = "warn", priority = 1 }
mutex_integer = { level = "warn", priority = 1 }
# Prefer normal string literals
needless_raw_strings = { level = "warn", priority = 1 }
# May not play well with all editors
non_ascii_literal = { level = "warn", priority = 1 }
# Consistent NonZero use can improve performance and maintain invariants
non_zero_suggestions = { level = "warn", priority = 1 }
# Don't panic. Return/handle errors.
panic = { level = "warn", priority = 1 }
panic_in_result_fn = { level = "warn", priority = 1 }
# Go all in one way or another. This is weird.
partial_pub_fields = { level = "warn", priority = 1 }
# Less readable.
pathbuf_init_then_push = { level = "warn", priority = 1 }
# Explicit ownership changes
pattern_type_mismatch = { level = "warn", priority = 1 }
# Explicit precedence for clarity
precedence_bits = { level = "warn", priority = 1 }
# Consistency
pub_without_shorthand = { level = "warn", priority = 1 }
# Usually not ideal.
rc_buffer = { level = "warn", priority = 1 }
# Rc is singlethreaded, Mutex is multithreaded. Weird to use together.
rc_mutex = { level = "warn", priority = 1 }
# Cargo test already adds test to the name
redundant_test_prefix = { level = "warn", priority = 1 }
# Use the existing name
renamed_function_params = { level = "warn", priority = 1 }
# Explicit matching is preferred.
rest_pat_in_fully_bound_structs = { level = "warn", priority = 1 }
# More concise
return_and_then = { level = "warn", priority = 1 }
# Confusing
same_name_method = { level = "warn", priority = 1 }
# Consistency
semicolon_outside_block = { level = "warn", priority = 1 }
# Use explicit lifetime names
single_char_lifetime_names = { level = "warn", priority = 1 }
# I'd rather use alloc than std
std_instead_of_alloc = { level = "warn", priority = 1 }
# I'd rather use core than std
std_instead_of_core = { level = "warn", priority = 1 }
# to_owned better expresses intent
str_to_string = { level = "warn", priority = 1 }
# push_str instead
string_add = { level = "warn", priority = 1 }
# Hurts performance
string_lit_chars_any = { level = "warn", priority = 1 }
# May panic/split chars
string_slice = { level = "warn", priority = 1 }
# I might make this mistake.
suspicious_xor_used_as_pow = { level = "warn", priority = 1 }
# Tests go in the test module.
tests_outside_test_module = { level = "warn", priority = 1 }
# I don't want to forget to go back and do this... plus it panics
todo = { level = "warn", priority = 1 }
# If you're using unsafe, justify it.
undocumented_unsafe_blocks = { level = "forbid", priority = 1 }
# Panics.
unimplemented = { level = "warn", priority = 1 }
# Confusing. Safe code doesn't need this.
unnecessary_safety_comment = { level = "warn", priority = 1 }
unnecessary_safety_doc = { level = "warn", priority = 1 }
# Messy.
unnecessary_self_imports = { level = "warn", priority = 1 }
# Panics. If using, justify.
unreachable = { level = "warn", priority = 1 }
# This makes it easier to read
unseparated_literal_suffix = { level = "warn", priority = 1 }
# This is probably a mistake
unused_result_ok = { level = "warn", priority = 1 }
# Useful for seeing traits in use
unused_trait_names = { level = "warn", priority = 1 }
# Just forward the error...
unwrap_in_result = { level = "warn", priority = 1 }
# Return/handle errors, don't panic.
unwrap_used = { level = "warn", priority = 1 }
# This might be a mistake
use_debug = { level = "warn", priority = 1 }
# This is easier.
verbose_file_reads = { level = "warn", priority = 1 }
# Explicit matching is preferred
wildcard_enum_match_arm = { level = "warn", priority = 1 }