1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Increase MSRV to 1.67 (#3234)

* Bump MSRV to 1.67

* clippy fixes

* cargo clippy: inline format args

* Add `clippy::uninlined_format_args` to cranky lints

* Fix clippy on wasm

* More clippy fixes
This commit is contained in:
Emil Ernerfeldt
2023-08-11 13:54:02 +02:00
committed by GitHub
parent bdeae9e959
commit 08fb447fb5
84 changed files with 166 additions and 193 deletions

View File

@@ -4,7 +4,7 @@ version = "0.22.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
description = "Minimal 2D graphics library for GUI work"
edition = "2021"
rust-version = "1.65"
rust-version = "1.67"
homepage = "https://github.com/emilk/egui/tree/master/crates/epaint"
license = "(MIT OR Apache-2.0) AND OFL-1.1 AND LicenseRef-UFL-1.0" # OFL and UFL used by default_fonts. See https://github.com/emilk/egui/issues/2321
readme = "README.md"

View File

@@ -251,8 +251,7 @@ impl Mesh {
assert!(
index_cursor > span_start,
"One triangle spanned more than {} vertices",
MAX_SIZE
"One triangle spanned more than {MAX_SIZE} vertices"
);
let mesh = Mesh16 {

View File

@@ -333,7 +333,7 @@ mod rw_lock_impl {
fn format_backtrace(backtrace: &mut backtrace::Backtrace) -> String {
backtrace.resolve();
let stacktrace = format!("{:?}", backtrace);
let stacktrace = format!("{backtrace:?}");
// Remove irrelevant parts of the stacktrace:
let end_offset = stacktrace

View File

@@ -106,7 +106,7 @@ impl AllocInfo {
element_size: ElementSize::Homogeneous(element_size),
num_allocs: 1,
num_elements: slice.len(),
num_bytes: slice.len() * element_size,
num_bytes: std::mem::size_of_val(slice),
}
}

View File

@@ -367,8 +367,7 @@ impl Font {
.or_else(|| slf.glyph_info_no_cache_or_fallback(FALLBACK_REPLACEMENT_CHAR))
.unwrap_or_else(|| {
panic!(
"Failed to find replacement characters {:?} or {:?}",
PRIMARY_REPLACEMENT_CHAR, FALLBACK_REPLACEMENT_CHAR
"Failed to find replacement characters {PRIMARY_REPLACEMENT_CHAR:?} or {FALLBACK_REPLACEMENT_CHAR:?}"
)
});
slf.replacement_glyph = replacement_glyph;

View File

@@ -200,7 +200,7 @@ fn ab_glyph_font_from_font_data(name: &str, data: &FontData) -> ab_glyph::FontAr
.map(ab_glyph::FontArc::from)
}
}
.unwrap_or_else(|err| panic!("Error parsing {:?} TTF/OTF font file: {}", name, err))
.unwrap_or_else(|err| panic!("Error parsing {name:?} TTF/OTF font file: {err}"))
}
/// Describes the font data and the sizes to use.
@@ -586,8 +586,7 @@ impl FontsImpl {
) -> Self {
assert!(
0.0 < pixels_per_point && pixels_per_point < 100.0,
"pixels_per_point out of range: {}",
pixels_per_point
"pixels_per_point out of range: {pixels_per_point}"
);
let texture_width = max_texture_side.at_most(8 * 1024);
@@ -627,9 +626,8 @@ impl FontsImpl {
.entry((HashableF32(*size), family.clone()))
.or_insert_with(|| {
let fonts = &self.definitions.families.get(family);
let fonts = fonts.unwrap_or_else(|| {
panic!("FontFamily::{:?} is not bound to any fonts", family)
});
let fonts = fonts
.unwrap_or_else(|| panic!("FontFamily::{family:?} is not bound to any fonts"));
let fonts: Vec<Arc<FontImpl>> = fonts
.iter()
@@ -752,17 +750,14 @@ impl FontImplCache {
let (tweak, ab_glyph_font) = self
.ab_glyph_fonts
.get(font_name)
.unwrap_or_else(|| panic!("No font data found for {:?}", font_name))
.unwrap_or_else(|| panic!("No font data found for {font_name:?}"))
.clone();
let scale_in_pixels = self.pixels_per_point * scale_in_points;
// Scale the font properly (see https://github.com/emilk/egui/issues/2068).
let units_per_em = ab_glyph_font.units_per_em().unwrap_or_else(|| {
panic!(
"The font unit size of {:?} exceeds the expected range (16..=16384)",
font_name
)
panic!("The font unit size of {font_name:?} exceeds the expected range (16..=16384)")
});
let font_scaling = ab_glyph_font.height_unscaled() / units_per_em;
let scale_in_pixels = scale_in_pixels * font_scaling;