Clippy fixes
This commit is contained in:
parent
339b28b470
commit
5c68edbb15
7 changed files with 20 additions and 13 deletions
|
@ -7,6 +7,7 @@
|
||||||
//! * [`three-d`](https://github.com/asny/three-d)
|
//! * [`three-d`](https://github.com/asny/three-d)
|
||||||
|
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||||
|
#![allow(unsafe_code)]
|
||||||
|
|
||||||
use eframe::egui;
|
use eframe::egui;
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ impl eframe::App for MyApp {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_exit(&mut self, gl: &glow::Context) {
|
fn on_exit(&mut self, gl: &glow::Context) {
|
||||||
self.rotating_triangle.lock().destroy(gl)
|
self.rotating_triangle.lock().destroy(gl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ impl eframe::App for MyApp {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::needless_pass_by_value)]
|
||||||
fn parse_response(response: ehttp::Response) -> Result<RetainedImage, String> {
|
fn parse_response(response: ehttp::Response) -> Result<RetainedImage, String> {
|
||||||
let content_type = response.content_type().unwrap_or_default();
|
let content_type = response.content_type().unwrap_or_default();
|
||||||
if content_type.starts_with("image/") {
|
if content_type.starts_with("image/") {
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Demo app for egui
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
use eframe::wasm_bindgen::{self, prelude::*};
|
use eframe::wasm_bindgen::{self, prelude::*};
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
//! Demo app for egui
|
||||||
|
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||||
|
|
||||||
// When compiling natively:
|
// When compiling natively:
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
demo_windows.ui(ctx);
|
demo_windows.ui(ctx);
|
||||||
});
|
});
|
||||||
ctx.tessellate(full_output.shapes)
|
ctx.tessellate(full_output.shapes)
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
c.bench_function("demo_no_tessellate", |b| {
|
c.bench_function("demo_no_tessellate", |b| {
|
||||||
|
@ -25,14 +25,14 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
ctx.run(RawInput::default(), |ctx| {
|
ctx.run(RawInput::default(), |ctx| {
|
||||||
demo_windows.ui(ctx);
|
demo_windows.ui(ctx);
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let full_output = ctx.run(RawInput::default(), |ctx| {
|
let full_output = ctx.run(RawInput::default(), |ctx| {
|
||||||
demo_windows.ui(ctx);
|
demo_windows.ui(ctx);
|
||||||
});
|
});
|
||||||
c.bench_function("demo_only_tessellate", |b| {
|
c.bench_function("demo_only_tessellate", |b| {
|
||||||
b.iter(|| ctx.tessellate(full_output.shapes.clone()))
|
b.iter(|| ctx.tessellate(full_output.shapes.clone()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
ctx.run(RawInput::default(), |ctx| {
|
ctx.run(RawInput::default(), |ctx| {
|
||||||
demo_windows.ui(ctx);
|
demo_windows.ui(ctx);
|
||||||
})
|
})
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,12 +56,12 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
c.bench_function("label &str", |b| {
|
c.bench_function("label &str", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
ui.label("the quick brown fox jumps over the lazy dog");
|
ui.label("the quick brown fox jumps over the lazy dog");
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
c.bench_function("label format!", |b| {
|
c.bench_function("label format!", |b| {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
ui.label("the quick brown fox jumps over the lazy dog".to_owned());
|
ui.label("the quick brown fox jumps over the lazy dog".to_owned());
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -77,7 +77,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
let rect = ui.max_rect();
|
let rect = ui.max_rect();
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
painter.rect(rect, 2.0, egui::Color32::RED, (1.0, egui::Color32::WHITE));
|
painter.rect(rect, 2.0, egui::Color32::RED, (1.0, egui::Color32::WHITE));
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
wrap_width,
|
wrap_width,
|
||||||
);
|
);
|
||||||
layout(&mut locked_fonts.fonts, job.into())
|
layout(&mut locked_fonts.fonts, job.into())
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
c.bench_function("text_layout_cached", |b| {
|
c.bench_function("text_layout_cached", |b| {
|
||||||
|
@ -119,7 +119,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
color,
|
color,
|
||||||
wrap_width,
|
wrap_width,
|
||||||
)
|
)
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
let galley = fonts.layout(LOREM_IPSUM_LONG.to_owned(), font_id, color, wrap_width);
|
let galley = fonts.layout(LOREM_IPSUM_LONG.to_owned(), font_id, color, wrap_width);
|
||||||
|
@ -131,7 +131,7 @@ pub fn criterion_benchmark(c: &mut Criterion) {
|
||||||
b.iter(|| {
|
b.iter(|| {
|
||||||
tessellator.tessellate_text(font_image_size, &text_shape, &mut mesh);
|
tessellator.tessellate_text(font_image_size, &text_shape, &mut mesh);
|
||||||
mesh.clear();
|
mesh.clear();
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
//! Example how to use [epi::NativeTexture] with glium.
|
//! Example how to use [`epi::NativeTexture`] with glium.
|
||||||
|
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ fn create_display(event_loop: &glutin::event_loop::EventLoop<()>) -> glium::Disp
|
||||||
glium::Display::new(window_builder, context_builder, event_loop).unwrap()
|
glium::Display::new(window_builder, context_builder, event_loop).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_glium_image(png_data: &[u8]) -> glium::texture::RawImage2d<u8> {
|
fn load_glium_image(png_data: &[u8]) -> glium::texture::RawImage2d<'_, u8> {
|
||||||
// Load image using the image crate:
|
// Load image using the image crate:
|
||||||
let image = image::load_from_memory(png_data).unwrap().to_rgba8();
|
let image = image::load_from_memory(png_data).unwrap().to_rgba8();
|
||||||
let image_dimensions = image.dimensions();
|
let image_dimensions = image.dimensions();
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
//! Example how to use pure `egui_glow` without [`epi`].
|
//! Example how to use pure `egui_glow` without [`epi`].
|
||||||
|
|
||||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
|
||||||
|
#![allow(unsafe_code)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut clear_color = [0.1, 0.1, 0.1];
|
let mut clear_color = [0.1, 0.1, 0.1];
|
||||||
|
|
Loading…
Reference in a new issue