Skip to content

Commit 2f7ff14

Browse files
authored
Merge pull request #2096 from iced-rs/fix/some-more-lints
Fix some `clippy::pedantic` lints
2 parents e8b01eb + 33d780f commit 2f7ff14

80 files changed

Lines changed: 291 additions & 257 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cargo/config.toml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[alias]
2+
lint = """
3+
clippy --workspace --no-deps -- \
4+
-D warnings \
5+
-D clippy::semicolon_if_nothing_returned \
6+
-D clippy::trivially-copy-pass-by-ref \
7+
-D clippy::default_trait_access \
8+
-D clippy::match-wildcard-for-single-variants \
9+
-D clippy::redundant-closure-for-method-calls \
10+
-D clippy::filter_map_next \
11+
-D clippy::manual_let_else \
12+
-D clippy::unused_async
13+
"""
14+
15+
nitpick = """
16+
clippy --workspace --no-deps -- \
17+
-D warnings \
18+
-D clippy::pedantic \
19+
-A clippy::must_use_candidate \
20+
-A clippy::return_self_not_must_use \
21+
-A clippy::needless_pass_by_value \
22+
-A clippy::cast_precision_loss \
23+
-A clippy::cast_sign_loss \
24+
-A clippy::cast_possible_truncation \
25+
-A clippy::match_same_arms \
26+
-A clippy::missing-errors-doc \
27+
-A clippy::missing-panics-doc \
28+
-A clippy::cast_lossless \
29+
-A clippy::doc_markdown \
30+
-A clippy::items_after_statements \
31+
-A clippy::too_many_lines \
32+
-A clippy::module_name_repetitions \
33+
-A clippy::if_not_else \
34+
-A clippy::redundant_else \
35+
-A clippy::used_underscore_binding \
36+
-A clippy::cast_possible_wrap \
37+
-A clippy::unnecessary_wraps \
38+
-A clippy::struct-excessive-bools \
39+
-A clippy::float-cmp \
40+
-A clippy::single_match_else \
41+
-A clippy::unreadable_literal \
42+
-A clippy::explicit_deref_methods \
43+
-A clippy::map_unwrap_or \
44+
-A clippy::unnested_or_patterns \
45+
-A clippy::similar_names \
46+
-A clippy::unused_self
47+
"""

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
components: clippy
1010
- uses: actions/checkout@master
1111
- name: Check lints
12-
run: cargo clippy --workspace --all-features --all-targets --no-deps -- -D warnings
12+
run: cargo lint

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ target/
22
pkg/
33
**/*.rs.bk
44
Cargo.lock
5-
.cargo/
65
dist/
76
traces/

core/src/element.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ where
293293
}
294294

295295
fn diff(&self, tree: &mut Tree) {
296-
self.widget.diff(tree)
296+
self.widget.diff(tree);
297297
}
298298

299299
fn width(&self) -> Length {
@@ -418,7 +418,7 @@ where
418418
viewport: &Rectangle,
419419
) {
420420
self.widget
421-
.draw(tree, renderer, theme, style, layout, cursor, viewport)
421+
.draw(tree, renderer, theme, style, layout, cursor, viewport);
422422
}
423423

424424
fn mouse_interaction(
@@ -508,7 +508,7 @@ where
508508
) {
509509
self.element
510510
.widget
511-
.operate(state, layout, renderer, operation)
511+
.operate(state, layout, renderer, operation);
512512
}
513513

514514
fn on_event(

core/src/gradient.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl Linear {
9595
stops: impl IntoIterator<Item = ColorStop>,
9696
) -> Self {
9797
for stop in stops {
98-
self = self.add_stop(stop.offset, stop.color)
98+
self = self.add_stop(stop.offset, stop.color);
9999
}
100100

101101
self

core/src/hasher.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pub struct Hasher(twox_hash::XxHash64);
44

55
impl core::hash::Hasher for Hasher {
66
fn write(&mut self, bytes: &[u8]) {
7-
self.0.write(bytes)
7+
self.0.write(bytes);
88
}
99

1010
fn finish(&self) -> u64 {

core/src/mouse/click.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub enum Kind {
2424
}
2525

2626
impl Kind {
27-
fn next(&self) -> Kind {
27+
fn next(self) -> Kind {
2828
match self {
2929
Kind::Single => Kind::Double,
3030
Kind::Double => Kind::Triple,

core/src/overlay/element.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ where
9898
layout: Layout<'_>,
9999
cursor: mouse::Cursor,
100100
) {
101-
self.overlay.draw(renderer, theme, style, layout, cursor)
101+
self.overlay.draw(renderer, theme, style, layout, cursor);
102102
}
103103

104104
/// Applies a [`widget::Operation`] to the [`Element`].
@@ -205,7 +205,7 @@ where
205205
state: &mut dyn widget::operation::TextInput,
206206
id: Option<&widget::Id>,
207207
) {
208-
self.operation.text_input(state, id)
208+
self.operation.text_input(state, id);
209209
}
210210

211211
fn custom(&mut self, state: &mut dyn Any, id: Option<&widget::Id>) {
@@ -262,7 +262,7 @@ where
262262
layout: Layout<'_>,
263263
cursor: mouse::Cursor,
264264
) {
265-
self.content.draw(renderer, theme, style, layout, cursor)
265+
self.content.draw(renderer, theme, style, layout, cursor);
266266
}
267267

268268
fn is_over(

core/src/overlay/group.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ where
143143
|(child, layout)| {
144144
child.operate(layout, renderer, operation);
145145
},
146-
)
146+
);
147147
});
148148
}
149149

core/src/shell.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ impl<'a, Message> Shell<'a, Message> {
7171
if self.is_layout_invalid {
7272
self.is_layout_invalid = false;
7373

74-
f()
74+
f();
7575
}
7676
}
7777

0 commit comments

Comments
 (0)