Skip to content

Commit 12c7daf

Browse files
committed
clippy: turn on a bunch of pedantic lints
1 parent 1858e6d commit 12c7daf

File tree

2 files changed

+129
-3
lines changed

2 files changed

+129
-3
lines changed

Cargo.toml

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,129 @@ serde_json = "1.0"
3434

3535
[dev-dependencies]
3636
wasm-bindgen-test = "0.3.50"
37+
38+
[lints.clippy]
39+
# Exclude lints we don't think are valuable.
40+
needless_question_mark = "allow" # https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
41+
manual_range_contains = "allow" # More readable than clippy's format.
42+
needless_raw_string_hashes = "allow" # No reason not to use raw strings
43+
uninlined_format_args = "allow" # This is a subjective style choice.
44+
float_cmp = "allow" # Bitcoin floats are typically limited to 8 decimal places and we want them exact.
45+
manual_let_else = "allow" # unsure about this one on stylistic grounds
46+
map_unwrap_or = "allow" # encourages use of `map_or_else` which takes two closures that the reader can't really distinguish
47+
match_bool = "allow" # Adds extra indentation and LOC.
48+
match_same_arms = "allow" # Collapses things that are conceptually unrelated to each other.
49+
must_use_candidate = "allow" # Useful for audit but many false positives.
50+
similar_names = "allow" # Too many (subjectively) false positives.
51+
single_match_else = "allow" # bad style; creates long lines and extra lines
52+
# Exhaustive list of pedantic clippy lints
53+
assigning_clones = "warn"
54+
bool_to_int_with_if = "warn"
55+
borrow_as_ptr = "warn"
56+
case_sensitive_file_extension_comparisons = "warn"
57+
cast_lossless = "warn"
58+
cast_possible_truncation = "allow" # All casts should include a code comment (except test code).
59+
cast_possible_wrap = "allow" # Same as above re code comment.
60+
cast_precision_loss = "warn"
61+
cast_ptr_alignment = "warn"
62+
cast_sign_loss = "allow" # All casts should include a code comment (except in test code).
63+
checked_conversions = "warn"
64+
cloned_instead_of_copied = "warn"
65+
copy_iterator = "warn"
66+
default_trait_access = "warn"
67+
doc_link_with_quotes = "warn"
68+
doc_markdown = "warn"
69+
empty_enum = "warn"
70+
enum_glob_use = "warn"
71+
expl_impl_clone_on_copy = "warn"
72+
explicit_deref_methods = "warn"
73+
explicit_into_iter_loop = "warn"
74+
explicit_iter_loop = "warn"
75+
filter_map_next = "warn"
76+
flat_map_option = "warn"
77+
fn_params_excessive_bools = "warn"
78+
from_iter_instead_of_collect = "warn"
79+
if_not_else = "warn"
80+
ignored_unit_patterns = "warn"
81+
implicit_clone = "warn"
82+
implicit_hasher = "warn"
83+
inconsistent_struct_constructor = "warn"
84+
index_refutable_slice = "warn"
85+
inefficient_to_string = "warn"
86+
inline_always = "warn"
87+
into_iter_without_iter = "warn"
88+
invalid_upcast_comparisons = "warn"
89+
items_after_statements = "warn"
90+
iter_filter_is_ok = "warn"
91+
iter_filter_is_some = "warn"
92+
iter_not_returning_iterator = "warn"
93+
iter_without_into_iter = "warn"
94+
large_digit_groups = "warn"
95+
large_futures = "warn"
96+
large_stack_arrays = "warn"
97+
large_types_passed_by_value = "warn"
98+
linkedlist = "warn"
99+
macro_use_imports = "warn"
100+
manual_assert = "warn"
101+
manual_instant_elapsed = "warn"
102+
manual_is_power_of_two = "warn"
103+
manual_is_variant_and = "warn"
104+
manual_ok_or = "warn"
105+
manual_string_new = "warn"
106+
many_single_char_names = "warn"
107+
match_wildcard_for_single_variants = "warn"
108+
maybe_infinite_iter = "warn"
109+
mismatching_type_param_order = "warn"
110+
missing_errors_doc = "allow" # FIXME this triggers 184 times; we should fix most
111+
missing_fields_in_debug = "warn"
112+
missing_panics_doc = "allow" # FIXME this one has 40 triggers
113+
mut_mut = "warn"
114+
naive_bytecount = "warn"
115+
needless_bitwise_bool = "warn"
116+
needless_continue = "warn"
117+
needless_for_each = "warn"
118+
needless_pass_by_value = "warn"
119+
no_effect_underscore_binding = "warn"
120+
no_mangle_with_rust_abi = "warn"
121+
option_as_ref_cloned = "warn"
122+
option_option = "warn"
123+
ptr_as_ptr = "warn"
124+
ptr_cast_constness = "warn"
125+
pub_underscore_fields = "warn"
126+
range_minus_one = "warn"
127+
range_plus_one = "warn"
128+
redundant_closure_for_method_calls = "warn"
129+
redundant_else = "warn"
130+
ref_as_ptr = "warn"
131+
ref_binding_to_reference = "warn"
132+
ref_option = "warn"
133+
ref_option_ref = "warn"
134+
return_self_not_must_use = "warn"
135+
same_functions_in_if_condition = "warn"
136+
semicolon_if_nothing_returned = "warn"
137+
should_panic_without_expect = "warn"
138+
single_char_pattern = "warn"
139+
stable_sort_primitive = "warn"
140+
str_split_at_newline = "warn"
141+
string_add_assign = "warn"
142+
struct_excessive_bools = "warn"
143+
struct_field_names = "warn"
144+
too_many_lines = "allow" # FIXME 14 triggers for this lint; probably most should be fixed
145+
transmute_ptr_to_ptr = "warn"
146+
trivially_copy_pass_by_ref = "warn"
147+
unchecked_duration_subtraction = "warn"
148+
unicode_not_nfc = "warn"
149+
unnecessary_box_returns = "warn"
150+
unnecessary_join = "warn"
151+
unnecessary_literal_bound = "warn"
152+
unnecessary_wraps = "warn"
153+
unnested_or_patterns = "warn"
154+
unreadable_literal = "warn"
155+
unsafe_derive_deserialize = "warn"
156+
unused_async = "warn"
157+
unused_self = "warn"
158+
used_underscore_binding = "warn"
159+
used_underscore_items = "warn"
160+
verbose_bit_mask = "warn"
161+
wildcard_imports = "warn"
162+
zero_sized_map_values = "warn"

src/components/program_window/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ pub fn ProgramWindow() -> impl IntoView {
4343
class:hamburger-active=mobile_open
4444
on:click=move |_| set_mobile_open.set(!mobile_open.get())
4545
>
46-
{move || if !mobile_open.get() {
47-
view! { <i class="fa-solid fa-bars"></i>}
48-
} else {
46+
{move || if mobile_open.get() {
4947
view! { <i class="fa-solid fa-xmark"></i> }
48+
} else {
49+
view! { <i class="fa-solid fa-bars"></i>}
5050
}}
5151
</div>
5252
</Toolbar>

0 commit comments

Comments
 (0)