From b18295a1ce1efbf1d0ab6551b5df1d7e6c511d50 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Wed, 8 Mar 2023 19:34:10 +0300 Subject: [PATCH] Bump MSRV to 1.64 --- .github/workflows/ci.yml | 10 +++++----- CHANGELOG.md | 2 ++ CONTRIBUTING.md | 2 +- Cargo.toml | 2 +- src/platform_impl/linux/wayland/output.rs | 2 +- .../linux/wayland/seat/text_input/handlers.rs | 4 ++-- src/platform_impl/linux/x11/ime/context.rs | 6 +++--- src/platform_impl/linux/x11/util/hint.rs | 2 +- src/platform_impl/windows/window_state.rs | 9 +++++---- 9 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54e62843..67b27507 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: strategy: fail-fast: false matrix: - rust_version: ['1.60.0', stable, nightly] + rust_version: ['1.64.0', stable, nightly] platform: # Note: Make sure that we test all the `docs.rs` targets defined in Cargo.toml! - { target: x86_64-pc-windows-msvc, os: windows-latest, } @@ -86,7 +86,7 @@ jobs: shell: bash if: > !contains(matrix.platform.target, 'redox') && - matrix.rust_version != '1.60.0' + matrix.rust_version != '1.64.0' run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES - name: Run tests @@ -96,7 +96,7 @@ jobs: !contains(matrix.platform.target, 'ios') && !contains(matrix.platform.target, 'wasm32') && !contains(matrix.platform.target, 'redox') && - matrix.rust_version != '1.60.0' + matrix.rust_version != '1.64.0' run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES - name: Lint with clippy @@ -108,7 +108,7 @@ jobs: shell: bash if: > !contains(matrix.platform.target, 'redox') && - matrix.rust_version != '1.60.0' + matrix.rust_version != '1.64.0' run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES - name: Run tests with serde enabled shell: bash @@ -117,5 +117,5 @@ jobs: !contains(matrix.platform.target, 'ios') && !contains(matrix.platform.target, 'wasm32') && !contains(matrix.platform.target, 'redox') && - matrix.rust_version != '1.60.0' + matrix.rust_version != '1.64.0' run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES diff --git a/CHANGELOG.md b/CHANGELOG.md index e250fe61..5f6d7176 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ And please only add new entries to the top of this list, right below the `# Unre # Unreleased +- Bump MSRV from `1.60` to `1.64`. + # 0.28.2 - Implement `HasRawDisplayHandle` for `EventLoop`. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed9959e0..f84f57e9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ your description of the issue as detailed as possible: When making a code contribution to winit, before opening your pull request, please make sure that: -- your patch builds with Winit's minimal supported rust version - Rust 1.60. +- your patch builds with Winit's minimal supported rust version - Rust 1.64. - you tested your modifications on all the platforms impacted, or if not possible detail which platforms were not tested, and what should be tested, so that a maintainer or another contributor can test them - you updated any relevant documentation in winit diff --git a/Cargo.toml b/Cargo.toml index 679b044a..c4661617 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" repository = "https://github.com/rust-windowing/winit" documentation = "https://docs.rs/winit" categories = ["gui"] -rust-version = "1.60.0" +rust-version = "1.64.0" [package.metadata.docs.rs] features = ["serde"] diff --git a/src/platform_impl/linux/wayland/output.rs b/src/platform_impl/linux/wayland/output.rs index 5744f62a..f796643d 100644 --- a/src/platform_impl/linux/wayland/output.rs +++ b/src/platform_impl/linux/wayland/output.rs @@ -171,7 +171,7 @@ impl MonitorHandle { sctk::output::with_output_info(&self.proxy, |info| { info.modes .iter() - .find_map(|mode| mode.is_current.then(|| mode.refresh_rate as u32)) + .find_map(|mode| mode.is_current.then_some(mode.refresh_rate as u32)) }) .flatten() } diff --git a/src/platform_impl/linux/wayland/seat/text_input/handlers.rs b/src/platform_impl/linux/wayland/seat/text_input/handlers.rs index 7f3b9fb6..bb94ed13 100644 --- a/src/platform_impl/linux/wayland/seat/text_input/handlers.rs +++ b/src/platform_impl/linux/wayland/seat/text_input/handlers.rs @@ -72,10 +72,10 @@ pub(super) fn handle_text_input( let text = text.unwrap_or_default(); let cursor_begin = usize::try_from(cursor_begin) .ok() - .and_then(|idx| text.is_char_boundary(idx).then(|| idx)); + .and_then(|idx| text.is_char_boundary(idx).then_some(idx)); let cursor_end = usize::try_from(cursor_end) .ok() - .and_then(|idx| text.is_char_boundary(idx).then(|| idx)); + .and_then(|idx| text.is_char_boundary(idx).then_some(idx)); inner.pending_preedit = Some(Preedit { text, diff --git a/src/platform_impl/linux/x11/ime/context.rs b/src/platform_impl/linux/x11/ime/context.rs index 4531cb80..ae3ff127 100644 --- a/src/platform_impl/linux/x11/ime/context.rs +++ b/src/platform_impl/linux/x11/ime/context.rs @@ -263,7 +263,7 @@ impl ImeContext { ptr::null_mut::<()>(), ); - (!ic.is_null()).then(|| ic) + (!ic.is_null()).then_some(ic) } unsafe fn create_preedit_ic( @@ -302,7 +302,7 @@ impl ImeContext { ptr::null_mut::<()>(), ); - (!ic.is_null()).then(|| ic) + (!ic.is_null()).then_some(ic) } unsafe fn create_nothing_ic( @@ -320,7 +320,7 @@ impl ImeContext { ptr::null_mut::<()>(), ); - (!ic.is_null()).then(|| ic) + (!ic.is_null()).then_some(ic) } pub(crate) fn focus(&self, xconn: &Arc) -> Result<(), XError> { diff --git a/src/platform_impl/linux/x11/util/hint.rs b/src/platform_impl/linux/x11/util/hint.rs index bc45b235..bde63c23 100644 --- a/src/platform_impl/linux/x11/util/hint.rs +++ b/src/platform_impl/linux/x11/util/hint.rs @@ -197,7 +197,7 @@ impl<'a> NormalHints<'a> { } pub fn get_resize_increments(&self) -> Option<(u32, u32)> { - has_flag(self.size_hints.flags, ffi::PResizeInc).then(|| { + has_flag(self.size_hints.flags, ffi::PResizeInc).then_some({ ( self.size_hints.width_inc as u32, self.size_hints.height_inc as u32, diff --git a/src/platform_impl/windows/window_state.rs b/src/platform_impl/windows/window_state.rs index bd7053d4..635f626c 100644 --- a/src/platform_impl/windows/window_state.rs +++ b/src/platform_impl/windows/window_state.rs @@ -371,10 +371,11 @@ impl WindowFlags { if diff.contains(WindowFlags::CLOSABLE) || new.contains(WindowFlags::CLOSABLE) { let flags = MF_BYCOMMAND - | new - .contains(WindowFlags::CLOSABLE) - .then(|| MF_ENABLED) - .unwrap_or(MF_DISABLED); + | if new.contains(WindowFlags::CLOSABLE) { + MF_ENABLED + } else { + MF_DISABLED + }; unsafe { EnableMenuItem(GetSystemMenu(window, 0), SC_CLOSE, flags);