Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
dhardy committed Nov 29, 2024
1 parent 9e37c5c commit 8fcd01d
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 18 deletions.
5 changes: 5 additions & 0 deletions crates/kas-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,8 @@ version = "0.30.1"
optional = true
default-features = false
features = ["rwh_06"]

[lints.clippy]
module_inception = "allow"
needless_lifetimes = "allow"
unit_arg = "allow"
17 changes: 7 additions & 10 deletions crates/kas-core/src/event/cx/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,16 @@ struct MouseGrab {
impl<'a> EventCx<'a> {
fn flush_mouse_grab_motion(&mut self) {
if let Some(grab) = self.mouse_grab.as_mut() {
match grab.details {
GrabDetails::Click { ref cur_id } => {
if grab.start_id == cur_id {
if grab.depress != *cur_id {
grab.depress = cur_id.clone();
self.action |= Action::REDRAW;
}
} else if grab.depress.is_some() {
grab.depress = None;
if let GrabDetails::Click { ref cur_id } = grab.details {
if grab.start_id == cur_id {
if grab.depress != *cur_id {
grab.depress = cur_id.clone();
self.action |= Action::REDRAW;
}
} else if grab.depress.is_some() {
grab.depress = None;
self.action |= Action::REDRAW;
}
_ => (),
}
}
}
Expand Down
15 changes: 7 additions & 8 deletions crates/kas-core/src/event/cx/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -371,14 +371,13 @@ impl<'a> EventCx<'a> {
// TODO(winit): https://github.com/rust-windowing/winit/issues/3038
let mut mods = self.modifiers;
mods.remove(ModifiersState::SHIFT);
if !mods.is_empty() {
event.text = None;
} else if event
.text
.as_ref()
.and_then(|t| t.chars().next())
.map(|c| c.is_control())
.unwrap_or(false)
if !mods.is_empty()
|| event
.text
.as_ref()
.and_then(|t| t.chars().next())
.map(|c| c.is_control())
.unwrap_or(false)
{
event.text = None;
}
Expand Down
4 changes: 4 additions & 0 deletions crates/kas-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ features = ["extra-traits", "full", "visit", "visit-mut"]

[build-dependencies]
version_check = "0.9"

[lints.clippy]
collapsible_else_if = "allow"
unit_arg = "allow"
5 changes: 5 additions & 0 deletions crates/kas-view/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ linear-map = "1.2.0"

# We must rename this package since macros expect kas to be in scope:
kas = { version = "0.14.1", package = "kas-core", path = "../kas-core" }

[lints.clippy]
collapsible_else_if = "allow"
needless_lifetimes = "allow"
unit_arg = "allow"
4 changes: 4 additions & 0 deletions crates/kas-wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,7 @@ features = ["spirv"]

[build-dependencies]
glob = "0.3"

[lints.clippy]
needless_lifetimes = "allow"
unit_arg = "allow"
9 changes: 9 additions & 0 deletions crates/kas-widgets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,12 @@ linear-map = "1.2.0"

# We must rename this package since macros expect kas to be in scope:
kas = { version = "0.14.1", package = "kas-core", path = "../kas-core" }

[lints.clippy]
collapsible_else_if = "allow"
collapsible_if = "allow"
comparison_chain = "allow"
module_inception = "allow"
needless_lifetimes = "allow"
redundant_pattern_matching = "allow"
unit_arg = "allow"
1 change: 1 addition & 0 deletions crates/kas-widgets/src/spinner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ macro_rules! impl_int {
((self / step).saturating_add(1)).saturating_mul(step).min(u_bound)
}
fn sub_step(self, step: Self, l_bound: Self) -> Self {
#[allow(clippy::manual_div_ceil)] // only stable on a subset of types used
(((self + step - 1) / step).saturating_sub(1)).saturating_mul(step).max(l_bound)
}
}
Expand Down

0 comments on commit 8fcd01d

Please sign in to comment.