Skip to content

Commit

Permalink
Update MSRV to Rust 1.79 (#5421)
Browse files Browse the repository at this point in the history
Mostly to fix `cargo-machete` CI
  • Loading branch information
emilk authored Dec 1, 2024
1 parent 7e3275c commit 328422d
Show file tree
Hide file tree
Showing 50 changed files with 94 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy_web_demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
16 changes: 14 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
7 changes: 5 additions & 2 deletions clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# -----------------------------------------------------------------------------
# Section identical to scripts/clippy_wasm/clippy.toml:

msrv = "1.77"
msrv = "1.79"

allow-unwrap-in-tests = true

Expand Down Expand Up @@ -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",
"..",
]
2 changes: 1 addition & 1 deletion crates/eframe/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/native/event_loop_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
34 changes: 3 additions & 31 deletions crates/eframe/src/web/web_painter_wgpu.rs
Original file line number Diff line number Diff line change
@@ -1,41 +1,13 @@
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 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),
)))
}
}
}
use crate::WebOptions;

#[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(),
)))
}
}
}
use super::web_painter::WebPainter;

pub(crate) struct WebPainterWgpu {
canvas: HtmlCanvasElement,
Expand Down
2 changes: 1 addition & 1 deletion crates/eframe/src/web/web_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>>>,

Expand Down
2 changes: 1 addition & 1 deletion crates/egui-wgpu/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/data/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub enum Key {
// `]`
CloseBracket,

/// \`, also known as "backquote" or "grave"
/// Also known as "backquote" or "grave"
Backtick,

/// `-`
Expand Down
6 changes: 3 additions & 3 deletions crates/egui/src/input_state/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::{
emath::{pos2, vec2, Align2, NumExt, Pos2, Rect, Vec2},
Align,
};
use std::f32::INFINITY;
const INFINITY: f32 = f32::INFINITY;

// ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/memory/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/widgets/slider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 1 addition & 2 deletions crates/egui_demo_lib/src/demo/sliders.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use egui::{style::HandleShape, Slider, SliderClamping, SliderOrientation, Ui};
use std::f64::INFINITY;

/// Showcase sliders
#[derive(PartialEq)]
Expand Down Expand Up @@ -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
};
Expand Down
2 changes: 1 addition & 1 deletion crates/egui_demo_lib/src/easy_mark/easy_mark_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions crates/emath/src/numeric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down
Loading

0 comments on commit 328422d

Please sign in to comment.