[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 =
|
||||
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);
|
||||
interact(
|
||||
|
||||
window_interaction(
|
||||
ctx,
|
||||
margins,
|
||||
possible,
|
||||
area_layer,
|
||||
area.state_mut(),
|
||||
window_id,
|
||||
resize_id,
|
||||
window_id.with("frame_resize"),
|
||||
last_frame_outer_rect,
|
||||
)
|
||||
.and_then(|window_interaction| {
|
||||
interact(
|
||||
window_interaction,
|
||||
ctx,
|
||||
margins,
|
||||
area_layer,
|
||||
area.state_mut(),
|
||||
resize_id,
|
||||
)
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
@ -301,22 +309,13 @@ impl WindowInteraction {
|
|||
}
|
||||
|
||||
fn interact(
|
||||
window_interaction: WindowInteraction,
|
||||
ctx: &Context,
|
||||
margins: Vec2,
|
||||
possible: PossibleInteractions,
|
||||
area_layer: Layer,
|
||||
area_state: &mut area::State,
|
||||
window_id: Id,
|
||||
resize_id: Id,
|
||||
rect: Rect,
|
||||
) -> 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 = ctx.round_rect_to_pixels(new_rect);
|
||||
|
|
|
@ -359,7 +359,7 @@ impl Default for Widgets {
|
|||
button_enabled: true,
|
||||
radio: 0,
|
||||
count: 0,
|
||||
slider_value: 3.14,
|
||||
slider_value: 3.4,
|
||||
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(),
|
||||
}
|
||||
|
|
|
@ -607,7 +607,7 @@ pub fn ease_in_ease_out(t: f32) -> f32 {
|
|||
///
|
||||
/// 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 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 {
|
||||
super::{
|
||||
color::{self, srgba, Color},
|
||||
|
|
|
@ -37,7 +37,7 @@ pub fn now_sec() -> f64 {
|
|||
pub fn seconds_since_midnight() -> f64 {
|
||||
let d = js_sys::Date::new_0();
|
||||
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 {
|
||||
|
@ -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
|
||||
/// a real text input or the name of a key.
|
||||
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
|
||||
|| matches!(
|
||||
key,
|
||||
|
|
Loading…
Reference in a new issue