clippy fixes from 1.69.0
This commit is contained in:
parent
4d360f67a4
commit
4d357b0f02
|
|
@ -126,7 +126,7 @@ impl CacheStorage {
|
||||||
pub fn cache<FrameCache: CacheTrait + Default>(&mut self) -> &mut FrameCache {
|
pub fn cache<FrameCache: CacheTrait + Default>(&mut self) -> &mut FrameCache {
|
||||||
self.caches
|
self.caches
|
||||||
.entry(std::any::TypeId::of::<FrameCache>())
|
.entry(std::any::TypeId::of::<FrameCache>())
|
||||||
.or_insert_with(|| Box::new(FrameCache::default()))
|
.or_insert_with(|| Box::<FrameCache>::default())
|
||||||
.as_any_mut()
|
.as_any_mut()
|
||||||
.downcast_mut::<FrameCache>()
|
.downcast_mut::<FrameCache>()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
|
|
|
||||||
|
|
@ -158,9 +158,11 @@ impl RotatingTriangle {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
gl.link_program(program);
|
gl.link_program(program);
|
||||||
if !gl.get_program_link_status(program) {
|
assert!(
|
||||||
panic!("{}", gl.get_program_info_log(program));
|
gl.get_program_link_status(program),
|
||||||
}
|
"{}",
|
||||||
|
gl.get_program_info_log(program)
|
||||||
|
);
|
||||||
|
|
||||||
for shader in shaders {
|
for shader in shaders {
|
||||||
gl.detach_shader(program, shader);
|
gl.detach_shader(program, shader);
|
||||||
|
|
|
||||||
|
|
@ -20,26 +20,26 @@ struct Demos {
|
||||||
impl Default for Demos {
|
impl Default for Demos {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::from_demos(vec![
|
Self::from_demos(vec![
|
||||||
Box::new(super::paint_bezier::PaintBezier::default()),
|
Box::<super::paint_bezier::PaintBezier>::default(),
|
||||||
Box::new(super::code_editor::CodeEditor::default()),
|
Box::<super::code_editor::CodeEditor>::default(),
|
||||||
Box::new(super::code_example::CodeExample::default()),
|
Box::<super::code_example::CodeExample>::default(),
|
||||||
Box::new(super::context_menu::ContextMenus::default()),
|
Box::<super::context_menu::ContextMenus>::default(),
|
||||||
Box::new(super::dancing_strings::DancingStrings::default()),
|
Box::<super::dancing_strings::DancingStrings>::default(),
|
||||||
Box::new(super::drag_and_drop::DragAndDropDemo::default()),
|
Box::<super::drag_and_drop::DragAndDropDemo>::default(),
|
||||||
Box::new(super::font_book::FontBook::default()),
|
Box::<super::font_book::FontBook>::default(),
|
||||||
Box::new(super::MiscDemoWindow::default()),
|
Box::<super::MiscDemoWindow>::default(),
|
||||||
Box::new(super::multi_touch::MultiTouch::default()),
|
Box::<super::multi_touch::MultiTouch>::default(),
|
||||||
Box::new(super::painting::Painting::default()),
|
Box::<super::painting::Painting>::default(),
|
||||||
Box::new(super::plot_demo::PlotDemo::default()),
|
Box::<super::plot_demo::PlotDemo>::default(),
|
||||||
Box::new(super::scrolling::Scrolling::default()),
|
Box::<super::scrolling::Scrolling>::default(),
|
||||||
Box::new(super::sliders::Sliders::default()),
|
Box::<super::sliders::Sliders>::default(),
|
||||||
Box::new(super::strip_demo::StripDemo::default()),
|
Box::<super::strip_demo::StripDemo>::default(),
|
||||||
Box::new(super::table_demo::TableDemo::default()),
|
Box::<super::table_demo::TableDemo>::default(),
|
||||||
Box::new(super::text_edit::TextEdit::default()),
|
Box::<super::text_edit::TextEdit>::default(),
|
||||||
Box::new(super::widget_gallery::WidgetGallery::default()),
|
Box::<super::widget_gallery::WidgetGallery>::default(),
|
||||||
Box::new(super::window_options::WindowOptions::default()),
|
Box::<super::window_options::WindowOptions>::default(),
|
||||||
Box::new(super::tests::WindowResizeTest::default()),
|
Box::<super::tests::WindowResizeTest>::default(),
|
||||||
Box::new(super::window_with_panels::WindowWithPanels::default()),
|
Box::<super::window_with_panels::WindowWithPanels>::default(),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,13 +89,13 @@ struct Tests {
|
||||||
impl Default for Tests {
|
impl Default for Tests {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::from_demos(vec![
|
Self::from_demos(vec![
|
||||||
Box::new(super::tests::CursorTest::default()),
|
Box::<super::tests::CursorTest>::default(),
|
||||||
Box::new(super::highlighting::Highlighting::default()),
|
Box::<super::highlighting::Highlighting>::default(),
|
||||||
Box::new(super::tests::IdTest::default()),
|
Box::<super::tests::IdTest>::default(),
|
||||||
Box::new(super::tests::InputTest::default()),
|
Box::<super::tests::InputTest>::default(),
|
||||||
Box::new(super::layout_test::LayoutTest::default()),
|
Box::<super::layout_test::LayoutTest>::default(),
|
||||||
Box::new(super::tests::ManualLayoutTest::default()),
|
Box::<super::tests::ManualLayoutTest>::default(),
|
||||||
Box::new(super::tests::TableTest::default()),
|
Box::<super::tests::TableTest>::default(),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ impl TableDemo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
body.heterogeneous_rows(
|
body.heterogeneous_rows(
|
||||||
(0..self.num_rows).into_iter().map(row_thickness),
|
(0..self.num_rows).map(row_thickness),
|
||||||
|row_index, mut row| {
|
|row_index, mut row| {
|
||||||
row.col(|ui| {
|
row.col(|ui| {
|
||||||
ui.label(row_index.to_string());
|
ui.label(row_index.to_string());
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,11 @@
|
||||||
use crate::*;
|
use crate::*;
|
||||||
|
|
||||||
/// left/center/right or top/center/bottom alignment for e.g. anchors and layouts.
|
/// left/center/right or top/center/bottom alignment for e.g. anchors and layouts.
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||||
pub enum Align {
|
pub enum Align {
|
||||||
/// Left or top.
|
/// Left or top.
|
||||||
|
#[default]
|
||||||
Min,
|
Min,
|
||||||
|
|
||||||
/// Horizontal or vertical center.
|
/// Horizontal or vertical center.
|
||||||
|
|
@ -136,13 +137,6 @@ impl Align {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Align {
|
|
||||||
#[inline(always)]
|
|
||||||
fn default() -> Align {
|
|
||||||
Align::Min
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Two-dimension alignment, e.g. [`Align2::LEFT_TOP`].
|
/// Two-dimension alignment, e.g. [`Align2::LEFT_TOP`].
|
||||||
|
|
|
||||||
|
|
@ -67,12 +67,13 @@ impl std::hash::Hash for FontId {
|
||||||
///
|
///
|
||||||
/// Which style of font: [`Monospace`][`FontFamily::Monospace`], [`Proportional`][`FontFamily::Proportional`],
|
/// Which style of font: [`Monospace`][`FontFamily::Monospace`], [`Proportional`][`FontFamily::Proportional`],
|
||||||
/// or by user-chosen name.
|
/// or by user-chosen name.
|
||||||
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
#[derive(Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
|
||||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||||
pub enum FontFamily {
|
pub enum FontFamily {
|
||||||
/// A font where some characters are wider than other (e.g. 'w' is wider than 'i').
|
/// A font where some characters are wider than other (e.g. 'w' is wider than 'i').
|
||||||
///
|
///
|
||||||
/// Proportional fonts are easier to read and should be the preferred choice in most situations.
|
/// Proportional fonts are easier to read and should be the preferred choice in most situations.
|
||||||
|
#[default]
|
||||||
Proportional,
|
Proportional,
|
||||||
|
|
||||||
/// A font where each character is the same width (`w` is the same width as `i`).
|
/// A font where each character is the same width (`w` is the same width as `i`).
|
||||||
|
|
@ -91,13 +92,6 @@ pub enum FontFamily {
|
||||||
Name(Arc<str>),
|
Name(Arc<str>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FontFamily {
|
|
||||||
#[inline]
|
|
||||||
fn default() -> Self {
|
|
||||||
FontFamily::Proportional
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl std::fmt::Display for FontFamily {
|
impl std::fmt::Display for FontFamily {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Confirm exit",
|
"Confirm exit",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -157,9 +157,11 @@ impl RotatingTriangle {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
gl.link_program(program);
|
gl.link_program(program);
|
||||||
if !gl.get_program_link_status(program) {
|
assert!(
|
||||||
panic!("{}", gl.get_program_info_log(program));
|
gl.get_program_link_status(program),
|
||||||
}
|
"{}",
|
||||||
|
gl.get_program_info_log(program)
|
||||||
|
);
|
||||||
|
|
||||||
for shader in shaders {
|
for shader in shaders {
|
||||||
gl.detach_shader(program, shader);
|
gl.detach_shader(program, shader);
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Custom window frame", // unused title
|
"Custom window frame", // unused title
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Download and show an image with eframe/egui",
|
"Download and show an image with eframe/egui",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Native file dialogs and drag-and-drop files",
|
"Native file dialogs and drag-and-drop files",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"My egui App",
|
"My egui App",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Keyboard events",
|
"Keyboard events",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(Content::default())),
|
Box::new(|_cc| Box::<Content>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"My egui App",
|
"My egui App",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Show an image with eframe/egui",
|
"Show an image with eframe/egui",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"Take screenshots and display with eframe/egui",
|
"Take screenshots and display with eframe/egui",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ fn main() -> Result<(), eframe::Error> {
|
||||||
eframe::run_native(
|
eframe::run_native(
|
||||||
"svg example",
|
"svg example",
|
||||||
options,
|
options,
|
||||||
Box::new(|_cc| Box::new(MyApp::default())),
|
Box::new(|_cc| Box::<MyApp>::default()),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue