From c60d17b91bb447f1d81343cf8be7809961b03d44 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Sat, 25 Dec 2021 19:32:25 +0100 Subject: [PATCH] Set MSRV to 1.56.0 and use rust edition 2021 (#998) --- .github/workflows/rust.yml | 18 +++++++++--------- CHANGELOG.md | 1 + eframe/Cargo.toml | 3 ++- egui-winit/Cargo.toml | 3 ++- egui-winit/src/epi.rs | 3 +-- egui/Cargo.toml | 3 ++- egui/src/lib.rs | 2 +- egui_demo_app/Cargo.toml | 3 ++- egui_demo_lib/Cargo.toml | 3 ++- egui_glium/Cargo.toml | 3 ++- egui_glow/Cargo.toml | 3 ++- egui_web/Cargo.toml | 3 ++- egui_web/src/backend.rs | 3 +-- emath/Cargo.toml | 3 ++- epaint/Cargo.toml | 3 ++- epaint/src/mesh.rs | 3 --- epi/Cargo.toml | 3 ++- rust-toolchain | 2 +- 18 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 2c1f4a1e..96db0602 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,7 +17,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: sudo apt-get update && sudo apt-get install libspeechd-dev - uses: actions-rs/cargo@v1 @@ -32,7 +32,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: sudo apt-get update && sudo apt-get install libspeechd-dev - uses: actions-rs/cargo@v1 @@ -48,7 +48,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: rustup target add wasm32-unknown-unknown - uses: actions-rs/cargo@v1 @@ -64,7 +64,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: rustup target add wasm32-unknown-unknown - uses: actions-rs/cargo@v1 @@ -80,7 +80,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: sudo apt-get update && sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev libgtk-3-dev # libgtk-3-dev is used by rfd - uses: actions-rs/cargo@v1 @@ -96,7 +96,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 @@ -112,7 +112,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: rustup component add clippy - run: sudo apt-get update && sudo apt-get install libspeechd-dev libgtk-3-dev # libgtk-3-dev is used by rfd @@ -129,7 +129,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: sudo apt-get update && sudo apt-get install libspeechd-dev - run: cargo doc -p emath -p epaint -p egui -p eframe -p epi -p egui_web -p egui-winit -p egui_glium -p egui_glow --lib --no-deps --all-features @@ -142,7 +142,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: 1.54.0 + toolchain: 1.56.0 override: true - run: sudo apt-get update && sudo apt-get install libspeechd-dev - run: rustup target add wasm32-unknown-unknown diff --git a/CHANGELOG.md b/CHANGELOG.md index fcee919a..03b3e3aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w * Add `Button::image_and_text` ([#832](https://github.com/emilk/egui/pull/832)). ### Changed 🔧 +* MSRV (Minimum Supported Rust Version) is now `1.56.0`. * `ui.add(Button::new("…").text_color(…))` is now `ui.button(RichText::new("…").color(…))` (same for `Label` )([#855](https://github.com/emilk/egui/pull/855)). * Plots now provide a `show` method that has to be used to add items to and show the plot ([#766](https://github.com/emilk/egui/pull/766)). * Replace `CtxRef::begin_frame` and `end_frame` with `CtxRef::run` ([#872](https://github.com/emilk/egui/pull/872)). diff --git a/eframe/Cargo.toml b/eframe/Cargo.toml index cfb5d552..548a7902 100644 --- a/eframe/Cargo.toml +++ b/eframe/Cargo.toml @@ -3,7 +3,8 @@ name = "eframe" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "egui framework - write GUI apps that compiles to web and/or natively" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/eframe" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/egui-winit/Cargo.toml b/egui-winit/Cargo.toml index 761e08af..4027960f 100644 --- a/egui-winit/Cargo.toml +++ b/egui-winit/Cargo.toml @@ -3,7 +3,8 @@ name = "egui-winit" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui with winit" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/egui-winit" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/egui-winit/src/epi.rs b/egui-winit/src/epi.rs index a10dcd7a..9daa2f98 100644 --- a/egui-winit/src/epi.rs +++ b/egui-winit/src/epi.rs @@ -292,9 +292,8 @@ impl EpiIntegration { } .build(); - let app = &mut self.app; // TODO: remove when we update MSVR to 1.56 let (egui_output, shapes) = self.egui_ctx.run(raw_input, |egui_ctx| { - app.update(egui_ctx, &mut frame); + self.app.update(egui_ctx, &mut frame); }); let needs_repaint = egui_output.needs_repaint; diff --git a/egui/Cargo.toml b/egui/Cargo.toml index d2091dde..72747052 100644 --- a/egui/Cargo.toml +++ b/egui/Cargo.toml @@ -3,7 +3,8 @@ name = "egui" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Simple, portable immediate mode GUI library for Rust" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui" license = "MIT OR Apache-2.0" readme = "../README.md" diff --git a/egui/src/lib.rs b/egui/src/lib.rs index e35d5c2b..4a9e7eca 100644 --- a/egui/src/lib.rs +++ b/egui/src/lib.rs @@ -3,7 +3,7 @@ //! Try the live web demo: . Read more about egui at . //! //! `egui` is in heavy development, with each new version having breaking changes. -//! You need to have rust 1.54.0 or later to use `egui`. +//! You need to have rust 1.56.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). diff --git a/egui_demo_app/Cargo.toml b/egui_demo_app/Cargo.toml index 0694c317..b214a817 100644 --- a/egui_demo_app/Cargo.toml +++ b/egui_demo_app/Cargo.toml @@ -3,7 +3,8 @@ name = "egui_demo_app" version = "0.15.0" authors = ["Emil Ernerfeldt "] license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" +rust-version = "1.56" publish = false [lib] diff --git a/egui_demo_lib/Cargo.toml b/egui_demo_lib/Cargo.toml index 75bbef7a..a2e3cf1c 100644 --- a/egui_demo_lib/Cargo.toml +++ b/egui_demo_lib/Cargo.toml @@ -3,7 +3,8 @@ name = "egui_demo_lib" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Example library for egui" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/egui_demo_lib" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/egui_glium/Cargo.toml b/egui_glium/Cargo.toml index 15b45cbc..53a9de6e 100644 --- a/egui_glium/Cargo.toml +++ b/egui_glium/Cargo.toml @@ -3,7 +3,8 @@ name = "egui_glium" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui natively using the glium library" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/egui_glium" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/egui_glow/Cargo.toml b/egui_glow/Cargo.toml index ac7acc3f..4db2ba1a 100644 --- a/egui_glow/Cargo.toml +++ b/egui_glow/Cargo.toml @@ -3,7 +3,8 @@ name = "egui_glow" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Bindings for using egui natively using the glow library" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/egui_glow" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/egui_web/Cargo.toml b/egui_web/Cargo.toml index da45cc48..4352f554 100644 --- a/egui_web/Cargo.toml +++ b/egui_web/Cargo.toml @@ -4,7 +4,8 @@ version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Bindings for compiling egui code to WASM for a web page" license = "MIT OR Apache-2.0" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/egui_web" readme = "README.md" repository = "https://github.com/emilk/egui/tree/master/egui_web" diff --git a/egui_web/src/backend.rs b/egui_web/src/backend.rs index d1118f52..c8c2efe5 100644 --- a/egui_web/src/backend.rs +++ b/egui_web/src/backend.rs @@ -198,9 +198,8 @@ impl AppRunner { } .build(); - let app = &mut self.app; // TODO: remove when we bump MSRV to 1.56 let (egui_output, shapes) = self.egui_ctx.run(raw_input, |egui_ctx| { - app.update(egui_ctx, &mut frame); + self.app.update(egui_ctx, &mut frame); }); let clipped_meshes = self.egui_ctx.tessellate(shapes); diff --git a/emath/Cargo.toml b/emath/Cargo.toml index ea7e8d8f..90046b08 100644 --- a/emath/Cargo.toml +++ b/emath/Cargo.toml @@ -3,7 +3,8 @@ name = "emath" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Minimal 2D math library for GUI work" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/emath" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/epaint/Cargo.toml b/epaint/Cargo.toml index 7e5d966a..6efb7e0a 100644 --- a/epaint/Cargo.toml +++ b/epaint/Cargo.toml @@ -3,7 +3,8 @@ name = "epaint" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Minimal 2D graphics library for GUI work" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/epaint" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/epaint/src/mesh.rs b/epaint/src/mesh.rs index 6ff3289a..78f1a9fb 100644 --- a/epaint/src/mesh.rs +++ b/epaint/src/mesh.rs @@ -64,7 +64,6 @@ impl Mesh { /// Are all indices within the bounds of the contained vertices? pub fn is_valid(&self) -> bool { - use std::convert::TryFrom; if let Ok(n) = u32::try_from(self.vertices.len()) { self.indices.iter().all(|&i| i < n) } else { @@ -223,7 +222,6 @@ impl Mesh { MAX_SIZE ); - use std::convert::TryFrom; let mesh = Mesh16 { indices: self.indices[span_start..index_cursor] .iter() @@ -267,7 +265,6 @@ pub struct Mesh16 { impl Mesh16 { /// Are all indices within the bounds of the contained vertices? pub fn is_valid(&self) -> bool { - use std::convert::TryFrom; if let Ok(n) = u16::try_from(self.vertices.len()) { self.indices.iter().all(|&i| i < n) } else { diff --git a/epi/Cargo.toml b/epi/Cargo.toml index 062ce2ec..83d0f762 100644 --- a/epi/Cargo.toml +++ b/epi/Cargo.toml @@ -3,7 +3,8 @@ name = "epi" version = "0.15.0" authors = ["Emil Ernerfeldt "] description = "Backend-agnostic interface for writing apps using egui" -edition = "2018" +edition = "2021" +rust-version = "1.56" homepage = "https://github.com/emilk/egui/tree/master/epi" license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/rust-toolchain b/rust-toolchain index fd917d1c..7e94f20b 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -5,6 +5,6 @@ # to the user in the error, instead of "error: invalid channel name '[toolchain]'". [toolchain] -channel = "1.54.0" +channel = "1.56.0" components = [ "rustfmt", "clippy" ] targets = [ "wasm32-unknown-unknown" ]