fix clippy issues

This commit is contained in:
Emil Ernerfeldt 2020-10-17 11:00:58 +02:00
parent 4fc34cca45
commit 4e0ea32d99
4 changed files with 6 additions and 5 deletions

View file

@ -35,7 +35,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
{ {
let mut ctx = egui::Context::new(); let mut ctx = egui::Context::new();
let mut ui = ctx.begin_frame(raw_input.clone()); let mut ui = ctx.begin_frame(raw_input);
c.bench_function("label", |b| { c.bench_function("label", |b| {
b.iter(|| { b.iter(|| {
ui.label(egui::demos::LOREM_IPSUM_LONG); ui.label(egui::demos::LOREM_IPSUM_LONG);

View file

@ -20,7 +20,7 @@
//! } //! }
//! ``` //! ```
#![deny(warnings)] #![cfg_attr(not(debug_assertions), deny(warnings))] // Forbid warnings in release builds
#![warn( #![warn(
clippy::all, clippy::all,
clippy::dbg_macro, clippy::dbg_macro,
@ -36,12 +36,10 @@
clippy::needless_continue, clippy::needless_continue,
clippy::pub_enum_variant_names, clippy::pub_enum_variant_names,
clippy::rest_pat_in_fully_bound_structs, clippy::rest_pat_in_fully_bound_structs,
// clippy::suboptimal_flops, // TODO
clippy::todo, clippy::todo,
// clippy::use_self,
future_incompatible, future_incompatible,
nonstandard_style, nonstandard_style,
rust_2018_idioms, rust_2018_idioms
)] )]
pub mod align; pub mod align;

View file

@ -159,6 +159,7 @@ pub fn almost_equal(a: f32, b: f32, epsilon: f32) -> bool {
} }
} }
#[allow(clippy::approx_constant)]
#[test] #[test]
fn test_format() { fn test_format() {
assert_eq!(format_with_minimum_precision(1_234_567.0, 0), "1234567"); assert_eq!(format_with_minimum_precision(1_234_567.0, 0), "1234567");
@ -204,6 +205,7 @@ fn test_almost_equal() {
} }
} }
#[allow(clippy::float_cmp)]
#[test] #[test]
fn test_remap() { fn test_remap() {
assert_eq!(remap_clamp(1.0, 0.0..=1.0, 0.0..=16.0), 16.0); assert_eq!(remap_clamp(1.0, 0.0..=1.0, 0.0..=16.0), 16.0);

View file

@ -112,6 +112,7 @@ fn simplest_digit_closed_range(min: i32, max: i32) -> i32 {
} }
} }
#[allow(clippy::approx_constant)]
#[test] #[test]
fn test_aim() { fn test_aim() {
assert_eq!(best_in_range_f64(-0.2, 0.0), 0.0, "Prefer zero"); assert_eq!(best_in_range_f64(-0.2, 0.0), 0.0, "Prefer zero");