clippy fixes for rust 1.53
This commit is contained in:
parent
60fd70921d
commit
269a4538d9
11 changed files with 24 additions and 25 deletions
|
@ -464,7 +464,7 @@ impl Areas {
|
|||
pub(crate) fn set_state(&mut self, layer_id: LayerId, state: area::State) {
|
||||
self.visible_current_frame.insert(layer_id);
|
||||
self.areas.insert(layer_id.id, state);
|
||||
if self.order.iter().find(|x| **x == layer_id).is_none() {
|
||||
if !self.order.iter().any(|x| *x == layer_id) {
|
||||
self.order.push(layer_id);
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ impl Areas {
|
|||
self.visible_current_frame.insert(layer_id);
|
||||
self.wants_to_be_on_top.insert(layer_id);
|
||||
|
||||
if self.order.iter().find(|x| **x == layer_id).is_none() {
|
||||
if !self.order.iter().any(|x| *x == layer_id) {
|
||||
self.order.push(layer_id);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,9 +269,6 @@ fn color_picker_hsvag_2d(ui: &mut Ui, hsva: &mut HsvaGamma, alpha: Alpha) {
|
|||
|
||||
if alpha == Alpha::Opaque {
|
||||
hsva.a = 1.0;
|
||||
show_color(ui, *hsva, current_color_size);
|
||||
ui.label("Selected color");
|
||||
ui.end_row();
|
||||
} else {
|
||||
let a = &mut hsva.a;
|
||||
|
||||
|
@ -287,12 +284,12 @@ fn color_picker_hsvag_2d(ui: &mut Ui, hsva: &mut HsvaGamma, alpha: Alpha) {
|
|||
ui.label("Alpha");
|
||||
ui.end_row();
|
||||
}
|
||||
|
||||
show_color(ui, *hsva, current_color_size);
|
||||
ui.label("Selected color");
|
||||
ui.end_row();
|
||||
}
|
||||
|
||||
show_color(ui, *hsva, current_color_size);
|
||||
ui.label("Selected color");
|
||||
ui.end_row();
|
||||
|
||||
ui.separator(); // TODO: fix ever-expansion
|
||||
ui.end_row();
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ impl epi::App for WrapApp {
|
|||
|
||||
fn update(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
|
||||
if let Some(web_info) = frame.info().web_info.as_ref() {
|
||||
if let Some(anchor) = web_info.web_location_hash.strip_prefix("#") {
|
||||
if let Some(anchor) = web_info.web_location_hash.strip_prefix('#') {
|
||||
self.selected_anchor = anchor.to_owned();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,12 +16,12 @@ fn create_display(event_loop: &glutin::event_loop::EventLoop<()>) -> glium::Disp
|
|||
.with_stencil_buffer(0)
|
||||
.with_vsync(true);
|
||||
|
||||
glium::Display::new(window_builder, context_builder, &event_loop).unwrap()
|
||||
glium::Display::new(window_builder, context_builder, event_loop).unwrap()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let event_loop = glutin::event_loop::EventLoop::with_user_event();
|
||||
let display = create_display(&&event_loop);
|
||||
let display = create_display(&event_loop);
|
||||
|
||||
let mut egui = egui_glium::EguiGlium::new(&display);
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ fn create_display(
|
|||
.with_stencil_buffer(0)
|
||||
.with_vsync(true);
|
||||
|
||||
let display = glium::Display::new(window_builder, context_builder, &event_loop).unwrap();
|
||||
let display = glium::Display::new(window_builder, context_builder, event_loop).unwrap();
|
||||
|
||||
if let Some(window_settings) = &window_settings {
|
||||
window_settings.restore_positions(&display);
|
||||
|
@ -154,7 +154,7 @@ fn integration_info(
|
|||
prefer_dark_mode: None, // TODO: figure out system default
|
||||
cpu_usage: previous_frame_time,
|
||||
seconds_since_midnight: seconds_since_midnight(),
|
||||
native_pixels_per_point: Some(native_pixels_per_point(&display)),
|
||||
native_pixels_per_point: Some(native_pixels_per_point(display)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -195,7 +195,7 @@ pub fn run(mut app: Box<dyn epi::App>, nativve_options: epi::NativeOptions) -> !
|
|||
repaint_signal: repaint_signal.clone(),
|
||||
}
|
||||
.build();
|
||||
app.setup(&ctx, &mut frame, storage.as_deref());
|
||||
app.setup(ctx, &mut frame, storage.as_deref());
|
||||
}
|
||||
|
||||
let mut previous_frame_time = None;
|
||||
|
@ -222,7 +222,7 @@ pub fn run(mut app: Box<dyn epi::App>, nativve_options: epi::NativeOptions) -> !
|
|||
}
|
||||
.build();
|
||||
|
||||
app.update(&ctx, &mut frame);
|
||||
app.update(ctx, &mut frame);
|
||||
|
||||
let _ = egui.end_frame(&display);
|
||||
|
||||
|
|
|
@ -504,7 +504,7 @@ impl EguiGlium {
|
|||
self.input_state.raw.time = Some(self.start_time.elapsed().as_nanos() as f64 * 1e-9);
|
||||
self.input_state.raw.screen_rect = Some(Rect::from_min_size(
|
||||
Default::default(),
|
||||
screen_size_in_pixels(&display) / pixels_per_point,
|
||||
screen_size_in_pixels(display) / pixels_per_point,
|
||||
));
|
||||
|
||||
self.egui_ctx.begin_frame(self.input_state.raw.take());
|
||||
|
|
|
@ -28,7 +28,7 @@ async fn fetch_jsvalue(request: &Request) -> Result<Response, JsValue> {
|
|||
opts.body(Some(&JsValue::from_str(body)));
|
||||
}
|
||||
|
||||
let request = web_sys::Request::new_with_str_and_init(&url, &opts)?;
|
||||
let request = web_sys::Request::new_with_str_and_init(url, &opts)?;
|
||||
request.headers().set("Accept", "*/*")?;
|
||||
|
||||
let window = web_sys::window().unwrap();
|
||||
|
|
|
@ -46,7 +46,7 @@ impl Align {
|
|||
|
||||
/// Convert `Min => 0.0`, `Center => 0.5` or `Max => 1.0`.
|
||||
#[inline(always)]
|
||||
pub fn to_factor(&self) -> f32 {
|
||||
pub fn to_factor(self) -> f32 {
|
||||
match self {
|
||||
Self::Min => 0.0,
|
||||
Self::Center => 0.5,
|
||||
|
@ -56,7 +56,7 @@ impl Align {
|
|||
|
||||
/// Convert `Min => -1.0`, `Center => 0.0` or `Max => 1.0`.
|
||||
#[inline(always)]
|
||||
pub fn to_sign(&self) -> f32 {
|
||||
pub fn to_sign(self) -> f32 {
|
||||
match self {
|
||||
Self::Min => -1.0,
|
||||
Self::Center => 0.0,
|
||||
|
@ -104,7 +104,7 @@ impl Align2 {
|
|||
}
|
||||
|
||||
/// -1, 0, or +1 for each axis
|
||||
pub fn to_sign(&self) -> Vec2 {
|
||||
pub fn to_sign(self) -> Vec2 {
|
||||
vec2(self.x().to_sign(), self.y().to_sign())
|
||||
}
|
||||
|
||||
|
|
|
@ -230,9 +230,7 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
|
|||
let max_decimals = max_decimals.min(16);
|
||||
let min_decimals = min_decimals.min(max_decimals);
|
||||
|
||||
if min_decimals == max_decimals {
|
||||
format!("{:.*}", max_decimals, value)
|
||||
} else {
|
||||
if min_decimals != max_decimals {
|
||||
// Ugly/slow way of doing this. TODO: clean up precision.
|
||||
for decimals in min_decimals..max_decimals {
|
||||
let text = format!("{:.*}", decimals, value);
|
||||
|
@ -245,8 +243,8 @@ pub fn format_with_decimals_in_range(value: f64, decimal_range: RangeInclusive<u
|
|||
// The value has more precision than we expected.
|
||||
// Probably the value was set not by the slider, but from outside.
|
||||
// In any case: show the full value
|
||||
format!("{:.*}", max_decimals, value)
|
||||
}
|
||||
format!("{:.*}", max_decimals, value)
|
||||
}
|
||||
|
||||
/// Return true when arguments are the same within some rounding error.
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
//! If you want to manipulate RGBA colors use [`Rgba`].
|
||||
//! If you want to manipulate colors in a way closer to how humans think about colors, use [`HsvaGamma`].
|
||||
|
||||
#![allow(clippy::wrong_self_convention)]
|
||||
|
||||
/// This format is used for space-efficient color representation (32 bits).
|
||||
///
|
||||
/// Instead of manipulating this directly it is often better
|
||||
|
|
|
@ -583,6 +583,8 @@ impl Galley {
|
|||
|
||||
#[test]
|
||||
fn test_text_layout() {
|
||||
#![allow(clippy::bool_assert_comparison)]
|
||||
|
||||
impl PartialEq for Cursor {
|
||||
fn eq(&self, other: &Cursor) -> bool {
|
||||
(self.ccursor, self.rcursor, self.pcursor)
|
||||
|
|
Loading…
Reference in a new issue