Update MSRV to Rust 1.79 (#5421)

Mostly to fix `cargo-machete` CI
This commit is contained in:
Emil Ernerfeldt 2024-12-01 18:58:35 +01:00 committed by GitHub
parent 7e3275ca5c
commit 328422dc62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
50 changed files with 94 additions and 103 deletions

View File

@ -39,7 +39,7 @@ jobs:
with:
profile: minimal
target: wasm32-unknown-unknown
toolchain: 1.77.0
toolchain: 1.79.0
override: true
- uses: Swatinem/rust-cache@v2

View File

@ -18,7 +18,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77.0
toolchain: 1.79.0
- name: Install packages (Linux)
if: runner.os == 'Linux'
@ -83,7 +83,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77.0
toolchain: 1.79.0
targets: wasm32-unknown-unknown
- run: sudo apt-get update && sudo apt-get install libgtk-3-dev libatk1.0-dev
@ -155,7 +155,7 @@ jobs:
- uses: actions/checkout@v4
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.77.0"
rust-version: "1.79.0"
log-level: error
command: check
arguments: --target ${{ matrix.target }}
@ -170,7 +170,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77.0
toolchain: 1.79.0
targets: aarch64-linux-android
- name: Set up cargo cache
@ -189,7 +189,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77.0
toolchain: 1.79.0
targets: aarch64-apple-ios
- name: Set up cargo cache
@ -208,7 +208,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77.0
toolchain: 1.79.0
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
@ -232,7 +232,7 @@ jobs:
lfs: true
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.77.0
toolchain: 1.79.0
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

View File

@ -23,7 +23,7 @@ members = [
[workspace.package]
edition = "2021"
license = "MIT OR Apache-2.0"
rust-version = "1.77"
rust-version = "1.79"
version = "0.29.1"
@ -145,6 +145,7 @@ disallowed_types = "warn" # See clippy.toml
doc_link_with_quotes = "warn"
doc_markdown = "warn"
empty_enum = "warn"
empty_enum_variants_with_brackets = "warn"
enum_glob_use = "warn"
equatable_if_let = "warn"
exit = "warn"
@ -169,6 +170,8 @@ inefficient_to_string = "warn"
infinite_loop = "warn"
into_iter_without_iter = "warn"
invalid_upcast_comparisons = "warn"
iter_filter_is_ok = "warn"
iter_filter_is_some = "warn"
iter_not_returning_iterator = "warn"
iter_on_empty_collections = "warn"
iter_on_single_items = "warn"
@ -185,6 +188,7 @@ macro_use_imports = "warn"
manual_assert = "warn"
manual_clamp = "warn"
manual_instant_elapsed = "warn"
manual_is_variant_and = "warn"
manual_let_else = "warn"
manual_ok_or = "warn"
manual_string_new = "warn"
@ -202,6 +206,7 @@ mismatching_type_param_order = "warn"
missing_enforced_import_renames = "warn"
missing_errors_doc = "warn"
missing_safety_doc = "warn"
mixed_attributes_style = "warn"
mut_mut = "warn"
mutex_integer = "warn"
needless_borrow = "warn"
@ -211,21 +216,25 @@ needless_pass_by_ref_mut = "warn"
needless_pass_by_value = "warn"
negative_feature_names = "warn"
nonstandard_macro_braces = "warn"
option_as_ref_cloned = "warn"
option_option = "warn"
path_buf_push_overwrite = "warn"
print_stderr = "warn"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
pub_underscore_fields = "warn"
pub_without_shorthand = "warn"
rc_mutex = "warn"
readonly_write_lock = "warn"
redundant_type_annotations = "warn"
ref_as_ptr = "warn"
ref_option_ref = "warn"
ref_patterns = "warn"
rest_pat_in_fully_bound_structs = "warn"
same_functions_in_if_condition = "warn"
semicolon_if_nothing_returned = "warn"
single_match_else = "warn"
str_split_at_newline = "warn"
str_to_string = "warn"
string_add = "warn"
string_add_assign = "warn"
@ -261,12 +270,15 @@ zero_sized_map_values = "warn"
# TODO(emilk): enable more of these lints:
iter_over_hash_type = "allow"
let_underscore_untyped = "allow"
missing_assert_message = "allow"
should_panic_without_expect = "allow"
too_many_lines = "allow"
unwrap_used = "allow" # TODO(emilk): We really wanna warn on this one
# These are meh:
assigning_clones = "allow" # No please
let_underscore_must_use = "allow"
let_underscore_untyped = "allow"
manual_range_contains = "allow" # this one is just worse imho
self_named_module_files = "allow" # Disabled waiting on https://github.com/rust-lang/rust-clippy/issues/9602
significant_drop_tightening = "allow" # Too many false positives

View File

@ -3,7 +3,7 @@
# -----------------------------------------------------------------------------
# Section identical to scripts/clippy_wasm/clippy.toml:
msrv = "1.77"
msrv = "1.79"
allow-unwrap-in-tests = true
@ -69,9 +69,12 @@ disallowed-types = [
# Allow-list of words for markdown in docstrings https://rust-lang.github.io/rust-clippy/master/index.html#doc_markdown
doc-valid-idents = [
# You must also update the same list in the root `clippy.toml`!
# You must also update the same list in `scripts/clippy_wasm/clippy.toml`!
"AccessKit",
"WebGL",
"WebGL1",
"WebGL2",
"WebGPU",
"VirtualBox",
"..",
]

View File

@ -439,7 +439,7 @@ pub struct WebOptions {
/// Unused by webgl context as of writing.
pub depth_buffer: u8,
/// Which version of WebGl context to select
/// Which version of WebGL context to select
///
/// Default: [`WebGlContextOption::BestFirst`].
#[cfg(feature = "glow")]

View File

@ -14,7 +14,7 @@ impl EventLoopGuard {
cell.get().is_none(),
"Attempted to set a new event loop while one is already set"
);
cell.set(Some(event_loop as *const ActiveEventLoop));
cell.set(Some(std::ptr::from_ref::<ActiveEventLoop>(event_loop)));
});
Self
}

View File

@ -1,42 +1,14 @@
use raw_window_handle::{
DisplayHandle, HandleError, HasDisplayHandle, HasWindowHandle, RawDisplayHandle,
RawWindowHandle, WebDisplayHandle, WebWindowHandle, WindowHandle,
};
use std::sync::Arc;
use wasm_bindgen::JsValue;
use web_sys::HtmlCanvasElement;
use crate::WebOptions;
use egui_wgpu::{RenderState, SurfaceErrorAction, WgpuSetup};
use crate::WebOptions;
use super::web_painter::WebPainter;
struct EguiWebWindow(u32);
#[allow(unsafe_code)]
impl HasWindowHandle for EguiWebWindow {
fn window_handle(&self) -> Result<WindowHandle<'_>, HandleError> {
// SAFETY: there is no lifetime here.
unsafe {
Ok(WindowHandle::borrow_raw(RawWindowHandle::Web(
WebWindowHandle::new(self.0),
)))
}
}
}
#[allow(unsafe_code)]
impl HasDisplayHandle for EguiWebWindow {
fn display_handle(&self) -> Result<DisplayHandle<'_>, HandleError> {
// SAFETY: there is no lifetime here.
unsafe {
Ok(DisplayHandle::borrow_raw(RawDisplayHandle::Web(
WebDisplayHandle::new(),
)))
}
}
}
pub(crate) struct WebPainterWgpu {
canvas: HtmlCanvasElement,
surface: wgpu::Surface<'static>,

View File

@ -16,7 +16,7 @@ pub struct WebRunner {
/// Have we ever panicked?
panic_handler: PanicHandler,
/// If we ever panic during running, this RefCell is poisoned.
/// If we ever panic during running, this `RefCell` is poisoned.
/// So before we use it, we need to check [`Self::panic_handler`].
runner: Rc<RefCell<Option<AppRunner>>>,

View File

@ -125,7 +125,7 @@ pub struct ScreenDescriptor {
/// Size of the window in physical pixels.
pub size_in_pixels: [u32; 2],
/// HiDPI scale factor (pixels per point).
/// High-DPI scale factor (pixels per point).
pub pixels_per_point: f32,
}

View File

@ -39,7 +39,7 @@ pub struct State {
scroll_start_offset_from_top_left: [Option<f32>; 2],
/// Is the scroll sticky. This is true while scroll handle is in the end position
/// and remains that way until the user moves the scroll_handle. Once unstuck (false)
/// and remains that way until the user moves the `scroll_handle`. Once unstuck (false)
/// it remains false until the scroll touches the end position, which reenables stickiness.
scroll_stuck_to_end: Vec2b,

View File

@ -55,7 +55,7 @@ pub enum Key {
// `]`
CloseBracket,
/// \`, also known as "backquote" or "grave"
/// Also known as "backquote" or "grave"
Backtick,
/// `-`

View File

@ -889,9 +889,9 @@ impl Default for PointerState {
press_start_time: None,
has_moved_too_much_for_a_click: false,
started_decidedly_dragging: false,
last_click_time: std::f64::NEG_INFINITY,
last_last_click_time: std::f64::NEG_INFINITY,
last_move_time: std::f64::NEG_INFINITY,
last_click_time: f64::NEG_INFINITY,
last_last_click_time: f64::NEG_INFINITY,
last_move_time: f64::NEG_INFINITY,
pointer_events: vec![],
input_options: Default::default(),
}

View File

@ -2,7 +2,7 @@ use crate::{
emath::{pos2, vec2, Align2, NumExt, Pos2, Rect, Vec2},
Align,
};
use std::f32::INFINITY;
const INFINITY: f32 = f32::INFINITY;
// ----------------------------------------------------------------------------

View File

@ -3,7 +3,7 @@
//! Try the live web demo: <https://www.egui.rs/#demo>. Read more about egui at <https://github.com/emilk/egui>.
//!
//! `egui` is in heavy development, with each new version having breaking changes.
//! You need to have rust 1.77.0 or later to use `egui`.
//! You need to have rust 1.79.0 or later to use `egui`.
//!
//! To quickly get started with egui, you can take a look at [`eframe_template`](https://github.com/emilk/eframe_template)
//! which uses [`eframe`](https://docs.rs/eframe).

View File

@ -736,7 +736,7 @@ impl Focus {
let current_rect = self.focus_widgets_cache.get(&current_focused.id)?;
let mut best_score = std::f32::INFINITY;
let mut best_score = f32::INFINITY;
let mut best_id = None;
for (candidate_id, candidate_rect) in &self.focus_widgets_cache {

View File

@ -288,7 +288,7 @@ pub struct Style {
/// If true and scrolling is enabled for only one direction, allow horizontal scrolling without pressing shift
pub always_scroll_the_only_direction: bool,
/// The animation that should be used when scrolling a [`crate::ScrollArea`] using e.g. [Ui::scroll_to_rect].
/// The animation that should be used when scrolling a [`crate::ScrollArea`] using e.g. [`Ui::scroll_to_rect`].
pub scroll_animation: ScrollAnimation,
}

View File

@ -1030,7 +1030,7 @@ impl<'a> Widget for Slider<'a> {
// Logarithmic sliders are allowed to include zero and infinity,
// even though mathematically it doesn't make sense.
use std::f64::INFINITY;
const INFINITY: f64 = f64::INFINITY;
/// When the user asks for an infinitely large range (e.g. logarithmic from zero),
/// give a scale that this many orders of magnitude in size.

View File

@ -1,5 +1,4 @@
use egui::{style::HandleShape, Slider, SliderClamping, SliderOrientation, Ui};
use std::f64::INFINITY;
/// Showcase sliders
#[derive(PartialEq)]
@ -77,7 +76,7 @@ impl crate::View for Sliders {
let (type_min, type_max) = if *integer {
((i32::MIN as f64), (i32::MAX as f64))
} else if *logarithmic {
(-INFINITY, INFINITY)
(-f64::INFINITY, f64::INFINITY)
} else {
(-1e5, 1e5) // linear sliders make little sense with huge numbers
};

View File

@ -13,7 +13,7 @@ pub enum Item<'a> {
// TODO(emilk): add Style here so empty heading still uses up the right amount of space.
Newline,
///
/// Text
Text(Style, &'a str),
/// title, url

View File

@ -18,8 +18,8 @@ macro_rules! impl_numeric_float {
($t: ident) => {
impl Numeric for $t {
const INTEGRAL: bool = false;
const MIN: Self = std::$t::MIN;
const MAX: Self = std::$t::MAX;
const MIN: Self = $t::MIN;
const MAX: Self = $t::MAX;
#[inline(always)]
fn to_f64(self) -> f64 {
@ -44,8 +44,8 @@ macro_rules! impl_numeric_integer {
($t: ident) => {
impl Numeric for $t {
const INTEGRAL: bool = true;
const MIN: Self = std::$t::MIN;
const MAX: Self = std::$t::MAX;
const MIN: Self = $t::MIN;
const MAX: Self = $t::MAX;
#[inline(always)]
fn to_f64(self) -> f64 {

View File

@ -1,4 +1,3 @@
use std::f32::INFINITY;
use std::fmt;
use crate::{lerp, pos2, vec2, Div, Mul, Pos2, Rangef, Rot2, Vec2};
@ -33,8 +32,8 @@ pub struct Rect {
impl Rect {
/// Infinite rectangle that contains every point.
pub const EVERYTHING: Self = Self {
min: pos2(-INFINITY, -INFINITY),
max: pos2(INFINITY, INFINITY),
min: pos2(-f32::INFINITY, -f32::INFINITY),
max: pos2(f32::INFINITY, f32::INFINITY),
};
/// The inverse of [`Self::EVERYTHING`]: stretches from positive infinity to negative infinity.
@ -53,8 +52,8 @@ impl Rect {
/// assert_eq!(rect, Rect::from_min_max(pos2(0.0, 1.0), pos2(2.0, 3.0)))
/// ```
pub const NOTHING: Self = Self {
min: pos2(INFINITY, INFINITY),
max: pos2(-INFINITY, -INFINITY),
min: pos2(f32::INFINITY, f32::INFINITY),
max: pos2(-f32::INFINITY, -f32::INFINITY),
};
/// An invalid [`Rect`] filled with [`f32::NAN`].

View File

@ -138,7 +138,9 @@ fn test_aim() {
assert_eq!(best_in_range_f64(99.999, 100.000), 100.0);
assert_eq!(best_in_range_f64(10.001, 100.001), 100.0);
use std::f64::{INFINITY, NAN, NEG_INFINITY};
const NAN: f64 = f64::NAN;
const INFINITY: f64 = f64::INFINITY;
const NEG_INFINITY: f64 = f64::NEG_INFINITY;
assert!(best_in_range_f64(NAN, NAN).is_nan());
assert_eq!(best_in_range_f64(NAN, 1.2), 1.2);
assert_eq!(best_in_range_f64(NAN, INFINITY), INFINITY);

View File

@ -75,7 +75,7 @@ mod mutex_impl {
// Detect if we are recursively taking out a lock on this mutex.
// use a pointer to the inner data as an id for this lock
let ptr = (&self.0 as *const parking_lot::Mutex<_>).cast::<()>();
let ptr = std::ptr::from_ref::<parking_lot::Mutex<_>>(&self.0).cast::<()>();
// Store it in thread local storage while we have a lock guard taken out
HELD_LOCKS_TLS.with(|held_locks| {

View File

@ -623,10 +623,10 @@ pub struct Glyph {
/// The row/line height of this font.
pub font_height: f32,
/// The ascent of the sub-font within the font ("FontImpl").
/// The ascent of the sub-font within the font (`FontImpl`).
pub font_impl_ascent: f32,
/// The row/line height of the sub-font within the font ("FontImpl").
/// The row/line height of the sub-font within the font (`FontImpl`).
pub font_impl_height: f32,
/// Position and size of the glyph in the font texture, in texels.

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["tami5 <kkharji@proton.me>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Varphone Wong <varphone@qq.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -3,7 +3,7 @@ name = "custom_style"
version = "0.1.0"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Maxim Osipenko <maxim1999max@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]
@ -29,6 +29,4 @@ env_logger = { version = "0.10", default-features = false, features = [
] }
# This is normally enabled by eframe/default, which is not being used here
# because of accesskit, as mentioned above
winit = { workspace = true, features = [
"default"
] }
winit = { workspace = true, features = ["default"] }

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Jan Procházka <github.com/jprochazk>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Jose Palazon <jose@palako.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -7,7 +7,7 @@ authors = [
]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["TicClick <ya@ticclick.ch>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -5,6 +5,6 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".
[toolchain]
channel = "1.77.0"
channel = "1.79.0"
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]

View File

@ -9,7 +9,7 @@ set -x
# Checks all tests, lints etc.
# Basically does what the CI does.
cargo +1.77.0 install --quiet typos-cli
cargo +1.79.0 install --quiet typos-cli
export RUSTFLAGS="-D warnings"
export RUSTDOCFLAGS="-D warnings" # https://github.com/emilk/egui/pull/1454

View File

@ -6,7 +6,7 @@
# -----------------------------------------------------------------------------
# Section identical to the root clippy.toml:
msrv = "1.77"
msrv = "1.79"
allow-unwrap-in-tests = true
@ -47,6 +47,9 @@ doc-valid-idents = [
# You must also update the same list in the root `clippy.toml`!
"AccessKit",
"WebGL",
"WebGL1",
"WebGL2",
"WebGPU",
"VirtualBox",
"..",
]

View File

@ -3,14 +3,17 @@ name = "test_egui_extras_compilation"
version = "0.1.0"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]
workspace = true
[package.metadata.cargo-machete]
ignored = ["eframe", "egui_extras"] # We don't use them, just check that things compile
ignored = [
"eframe",
"egui_extras",
] # We don't use them, just check that things compile
[dependencies]
eframe = { workspace = true, features = ["default", "persistence"] }

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Emil Ernerfeldt <emil.ernerfeldt@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["Antoine Beyeler <abeyeler@gmail.com>"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]

View File

@ -4,7 +4,7 @@ version = "0.1.0"
authors = ["konkitoman"]
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.77"
rust-version = "1.79"
publish = false
[lints]