lints: A bunch of extra style lint fixes (#36568)
- **lints: Fix 'doc_lazy_continuation'** - **lints: Fix 'doc_overindented_list_items'** - **inherent_to_string and io_other_error** - **Some more lint fixes** - **lints: enable bool_assert_comparison, match_like_matches_macro and wrong_self_convention** Release Notes: - N/A
This commit is contained in:
@@ -667,7 +667,7 @@ pub(super) const DEFAULT_CURSOR_ICON_NAME: &str = "left_ptr";
|
||||
|
||||
impl CursorStyle {
|
||||
#[cfg(any(feature = "wayland", feature = "x11"))]
|
||||
pub(super) fn to_icon_names(&self) -> &'static [&'static str] {
|
||||
pub(super) fn to_icon_names(self) -> &'static [&'static str] {
|
||||
// Based on cursor names from chromium:
|
||||
// https://github.com/chromium/chromium/blob/d3069cf9c973dc3627fa75f64085c6a86c8f41bf/ui/base/cursor/cursor_factory.cc#L113
|
||||
match self {
|
||||
@@ -990,21 +990,18 @@ mod tests {
|
||||
#[test]
|
||||
fn test_is_within_click_distance() {
|
||||
let zero = Point::new(px(0.0), px(0.0));
|
||||
assert_eq!(
|
||||
is_within_click_distance(zero, Point::new(px(5.0), px(5.0))),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
is_within_click_distance(zero, Point::new(px(-4.9), px(5.0))),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
is_within_click_distance(Point::new(px(3.0), px(2.0)), Point::new(px(-2.0), px(-2.0))),
|
||||
true
|
||||
);
|
||||
assert_eq!(
|
||||
is_within_click_distance(zero, Point::new(px(5.0), px(5.1))),
|
||||
false
|
||||
);
|
||||
assert!(is_within_click_distance(zero, Point::new(px(5.0), px(5.0))));
|
||||
assert!(is_within_click_distance(
|
||||
zero,
|
||||
Point::new(px(-4.9), px(5.0))
|
||||
));
|
||||
assert!(is_within_click_distance(
|
||||
Point::new(px(3.0), px(2.0)),
|
||||
Point::new(px(-2.0), px(-2.0))
|
||||
));
|
||||
assert!(!is_within_click_distance(
|
||||
zero,
|
||||
Point::new(px(5.0), px(5.1))
|
||||
),);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ use wayland_protocols::wp::cursor_shape::v1::client::wp_cursor_shape_device_v1::
|
||||
use crate::CursorStyle;
|
||||
|
||||
impl CursorStyle {
|
||||
pub(super) fn to_shape(&self) -> Shape {
|
||||
pub(super) fn to_shape(self) -> Shape {
|
||||
match self {
|
||||
CursorStyle::Arrow => Shape::Default,
|
||||
CursorStyle::IBeam => Shape::Text,
|
||||
|
||||
@@ -1139,7 +1139,7 @@ fn update_window(mut state: RefMut<WaylandWindowState>) {
|
||||
}
|
||||
|
||||
impl WindowDecorations {
|
||||
fn to_xdg(&self) -> zxdg_toplevel_decoration_v1::Mode {
|
||||
fn to_xdg(self) -> zxdg_toplevel_decoration_v1::Mode {
|
||||
match self {
|
||||
WindowDecorations::Client => zxdg_toplevel_decoration_v1::Mode::ClientSide,
|
||||
WindowDecorations::Server => zxdg_toplevel_decoration_v1::Mode::ServerSide,
|
||||
@@ -1148,7 +1148,7 @@ impl WindowDecorations {
|
||||
}
|
||||
|
||||
impl ResizeEdge {
|
||||
fn to_xdg(&self) -> xdg_toplevel::ResizeEdge {
|
||||
fn to_xdg(self) -> xdg_toplevel::ResizeEdge {
|
||||
match self {
|
||||
ResizeEdge::Top => xdg_toplevel::ResizeEdge::Top,
|
||||
ResizeEdge::TopRight => xdg_toplevel::ResizeEdge::TopRight,
|
||||
|
||||
@@ -95,7 +95,7 @@ fn query_render_extent(
|
||||
}
|
||||
|
||||
impl ResizeEdge {
|
||||
fn to_moveresize(&self) -> u32 {
|
||||
fn to_moveresize(self) -> u32 {
|
||||
match self {
|
||||
ResizeEdge::TopLeft => 0,
|
||||
ResizeEdge::Top => 1,
|
||||
|
||||
Reference in New Issue
Block a user