[clippy] fix all clippy issues
This commit is contained in:
parent
eb713ac514
commit
df2cba41ff
5 changed files with 20 additions and 20 deletions
|
@ -171,16 +171,24 @@ impl<'open> Window<'open> {
|
||||||
let title_bar_height =
|
let title_bar_height =
|
||||||
title_label.font_height(ctx.fonts()) + 1.0 * ctx.style().item_spacing.y; // this could be better
|
title_label.font_height(ctx.fonts()) + 1.0 * ctx.style().item_spacing.y; // this could be better
|
||||||
let margins = 2.0 * frame.margin + vec2(0.0, title_bar_height);
|
let margins = 2.0 * frame.margin + vec2(0.0, title_bar_height);
|
||||||
interact(
|
|
||||||
|
window_interaction(
|
||||||
ctx,
|
ctx,
|
||||||
margins,
|
|
||||||
possible,
|
possible,
|
||||||
area_layer,
|
area_layer,
|
||||||
area.state_mut(),
|
window_id.with("frame_resize"),
|
||||||
window_id,
|
|
||||||
resize_id,
|
|
||||||
last_frame_outer_rect,
|
last_frame_outer_rect,
|
||||||
)
|
)
|
||||||
|
.and_then(|window_interaction| {
|
||||||
|
interact(
|
||||||
|
window_interaction,
|
||||||
|
ctx,
|
||||||
|
margins,
|
||||||
|
area_layer,
|
||||||
|
area.state_mut(),
|
||||||
|
resize_id,
|
||||||
|
)
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
@ -301,22 +309,13 @@ impl WindowInteraction {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn interact(
|
fn interact(
|
||||||
|
window_interaction: WindowInteraction,
|
||||||
ctx: &Context,
|
ctx: &Context,
|
||||||
margins: Vec2,
|
margins: Vec2,
|
||||||
possible: PossibleInteractions,
|
|
||||||
area_layer: Layer,
|
area_layer: Layer,
|
||||||
area_state: &mut area::State,
|
area_state: &mut area::State,
|
||||||
window_id: Id,
|
|
||||||
resize_id: Id,
|
resize_id: Id,
|
||||||
rect: Rect,
|
|
||||||
) -> Option<WindowInteraction> {
|
) -> Option<WindowInteraction> {
|
||||||
let window_interaction = window_interaction(
|
|
||||||
ctx,
|
|
||||||
possible,
|
|
||||||
area_layer,
|
|
||||||
window_id.with("frame_resize"),
|
|
||||||
rect,
|
|
||||||
)?;
|
|
||||||
let new_rect = resize_window(ctx, &window_interaction)?;
|
let new_rect = resize_window(ctx, &window_interaction)?;
|
||||||
|
|
||||||
let new_rect = ctx.round_rect_to_pixels(new_rect);
|
let new_rect = ctx.round_rect_to_pixels(new_rect);
|
||||||
|
|
|
@ -359,7 +359,7 @@ impl Default for Widgets {
|
||||||
button_enabled: true,
|
button_enabled: true,
|
||||||
radio: 0,
|
radio: 0,
|
||||||
count: 0,
|
count: 0,
|
||||||
slider_value: 3.14,
|
slider_value: 3.4,
|
||||||
single_line_text_input: "Hello World!".to_owned(),
|
single_line_text_input: "Hello World!".to_owned(),
|
||||||
multiline_text_input: "Text can both be so wide that it needs a linebreak, but you can also add manual linebreak by pressing enter, creating new paragraphs.\nThis is the start of the next paragraph.\n\nClick me to edit me!".to_owned(),
|
multiline_text_input: "Text can both be so wide that it needs a linebreak, but you can also add manual linebreak by pressing enter, creating new paragraphs.\nThis is the start of the next paragraph.\n\nClick me to edit me!".to_owned(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -607,7 +607,7 @@ pub fn ease_in_ease_out(t: f32) -> f32 {
|
||||||
///
|
///
|
||||||
/// Represents one turn in radian angles. Equal to `2 * pi`.
|
/// Represents one turn in radian angles. Equal to `2 * pi`.
|
||||||
///
|
///
|
||||||
/// See https://tauday.com/
|
/// See <https://tauday.com/>
|
||||||
pub const TAU: f32 = 2.0 * std::f32::consts::PI;
|
pub const TAU: f32 = 2.0 * std::f32::consts::PI;
|
||||||
|
|
||||||
pub fn round_to_precision(value: f32, precision: usize) -> f32 {
|
pub fn round_to_precision(value: f32, precision: usize) -> f32 {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/// Outputs render info in a format suitable for e.g. OpenGL.
|
#![allow(clippy::identity_op)]
|
||||||
|
|
||||||
use {
|
use {
|
||||||
super::{
|
super::{
|
||||||
color::{self, srgba, Color},
|
color::{self, srgba, Color},
|
||||||
|
|
|
@ -37,7 +37,7 @@ pub fn now_sec() -> f64 {
|
||||||
pub fn seconds_since_midnight() -> f64 {
|
pub fn seconds_since_midnight() -> f64 {
|
||||||
let d = js_sys::Date::new_0();
|
let d = js_sys::Date::new_0();
|
||||||
let seconds = (d.get_hours() * 60 + d.get_minutes()) * 60 + d.get_seconds();
|
let seconds = (d.get_hours() * 60 + d.get_minutes()) * 60 + d.get_seconds();
|
||||||
return seconds as f64 + 1e-3 * (d.get_milliseconds() as f64);
|
seconds as f64 + 1e-3 * (d.get_milliseconds() as f64)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn pixels_per_point() -> f32 {
|
pub fn pixels_per_point() -> f32 {
|
||||||
|
@ -187,7 +187,7 @@ pub fn location_hash() -> Option<String> {
|
||||||
/// Web sends all all keys as strings, so it is up to us to figure out if it is
|
/// Web sends all all keys as strings, so it is up to us to figure out if it is
|
||||||
/// a real text input or the name of a key.
|
/// a real text input or the name of a key.
|
||||||
fn should_ignore_key(key: &str) -> bool {
|
fn should_ignore_key(key: &str) -> bool {
|
||||||
let is_function_key = key.starts_with("F") && key.len() > 1;
|
let is_function_key = key.starts_with('F') && key.len() > 1;
|
||||||
is_function_key
|
is_function_key
|
||||||
|| matches!(
|
|| matches!(
|
||||||
key,
|
key,
|
||||||
|
|
Loading…
Reference in a new issue