Skip to content

Commit 9d56b48

Browse files
authored
Merge pull request #3030 from iced-rs/rust-1.89
Fix lints for Rust 1.89 and bump MSRV to `1.88`
2 parents 88185f9 + d5cd0a6 commit 9d56b48

File tree

21 files changed

+370
-405
lines changed

21 files changed

+370
-405
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
matrix:
1111
os: [ubuntu-latest, windows-latest, macOS-latest]
12-
rust: [stable, beta, "1.85"]
12+
rust: [stable, beta, "1.88"]
1313
steps:
1414
- uses: hecrj/setup-rust-action@v2
1515
with:
@@ -23,5 +23,7 @@ jobs:
2323
sudo apt-get install -y libxkbcommon-dev libgtk-3-dev
2424
- name: Run tests
2525
run: |
26+
cargo test --verbose --workspace
2627
cargo test --verbose --workspace -- --ignored
28+
cargo test --verbose --workspace --all-features
2729
cargo test --verbose --workspace --all-features -- --ignored

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ repository = "https://github.com/iced-rs/iced"
145145
homepage = "https://iced.rs"
146146
categories = ["gui"]
147147
keywords = ["gui", "ui", "graphics", "interface", "widgets"]
148-
rust-version = "1.85"
148+
rust-version = "1.88"
149149

150150
[workspace.dependencies]
151151
iced = { version = "0.14.0-dev", path = "." }

examples/editor/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,10 @@ impl Editor {
119119

120120
let mut text = self.content.text();
121121

122-
if let Some(ending) = self.content.line_ending() {
123-
if !text.ends_with(ending.as_str()) {
124-
text.push_str(ending.as_str());
125-
}
122+
if let Some(ending) = self.content.line_ending()
123+
&& !text.ends_with(ending.as_str())
124+
{
125+
text.push_str(ending.as_str());
126126
}
127127

128128
Task::perform(

examples/pane_grid/src/main.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,10 @@ impl Example {
7171
}
7272
}
7373
Message::FocusAdjacent(direction) => {
74-
if let Some(pane) = self.focus {
75-
if let Some(adjacent) = self.panes.adjacent(pane, direction)
76-
{
77-
self.focus = Some(adjacent);
78-
}
74+
if let Some(pane) = self.focus
75+
&& let Some(adjacent) = self.panes.adjacent(pane, direction)
76+
{
77+
self.focus = Some(adjacent);
7978
}
8079
}
8180
Message::Clicked(pane) => {
@@ -106,14 +105,12 @@ impl Example {
106105
}
107106
}
108107
Message::CloseFocused => {
109-
if let Some(pane) = self.focus {
110-
if let Some(Pane { is_pinned, .. }) = self.panes.get(pane) {
111-
if !is_pinned {
112-
if let Some((_, sibling)) = self.panes.close(pane) {
113-
self.focus = Some(sibling);
114-
}
115-
}
116-
}
108+
if let Some(pane) = self.focus
109+
&& let Some(Pane { is_pinned, .. }) = self.panes.get(pane)
110+
&& !is_pinned
111+
&& let Some((_, sibling)) = self.panes.close(pane)
112+
{
113+
self.focus = Some(sibling);
117114
}
118115
}
119116
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0e355b080ad33905145e9f70a3b29e2481197c8fc8f42491acd5358238ebbd5f
1+
99f418007af163f172e163565f166da31015521e1bf7de95fa55cda2fb5a7db5

examples/todos/snapshots/creates_a_new_task-wgpu.sha256

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/websocket/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ impl WebSocket {
116116
let mut button = button(text("Send").height(40).align_y(Center))
117117
.padding([0, 20]);
118118

119-
if matches!(self.state, State::Connected(_)) {
120-
if let Some(message) = echo::Message::new(&self.new_message) {
121-
input = input.on_submit(Message::Send(message.clone()));
122-
button = button.on_press(Message::Send(message));
123-
}
119+
if matches!(self.state, State::Connected(_))
120+
&& let Some(message) = echo::Message::new(&self.new_message)
121+
{
122+
input = input.on_submit(Message::Send(message.clone()));
123+
button = button.on_press(Message::Send(message));
124124
}
125125

126126
row![input, button].spacing(10).align_y(Center)

graphics/src/text/editor.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,11 @@ impl editor::Editor for Editor {
321321
);
322322

323323
// Deselect if selection matches cursor position
324-
if let Some((start, end)) = editor.selection_bounds() {
325-
if start.line == end.line && start.index == end.index {
326-
editor.set_selection(cosmic_text::Selection::None);
327-
}
324+
if let Some((start, end)) = editor.selection_bounds()
325+
&& start.line == end.line
326+
&& start.index == end.index
327+
{
328+
editor.set_selection(cosmic_text::Selection::None);
328329
}
329330
}
330331
Action::SelectWord => {
@@ -438,10 +439,11 @@ impl editor::Editor for Editor {
438439
);
439440

440441
// Deselect if selection matches cursor position
441-
if let Some((start, end)) = editor.selection_bounds() {
442-
if start.line == end.line && start.index == end.index {
443-
editor.set_selection(cosmic_text::Selection::None);
444-
}
442+
if let Some((start, end)) = editor.selection_bounds()
443+
&& start.line == end.line
444+
&& start.index == end.index
445+
{
446+
editor.set_selection(cosmic_text::Selection::None);
445447
}
446448
}
447449
Action::Scroll { lines } => {

wgpu/src/image/raster.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,8 @@ impl Cache {
9999
self.map.retain(|k, memory| {
100100
let retain = hits.contains(k);
101101

102-
if !retain {
103-
if let Memory::Device(entry) = memory {
104-
atlas.remove(entry);
105-
}
102+
if !retain && let Memory::Device(entry) = memory {
103+
atlas.remove(entry);
106104
}
107105

108106
retain

widget/src/checkbox.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,9 @@ where
320320
| Event::Touch(touch::Event::FingerPressed { .. }) => {
321321
let mouse_over = cursor.is_over(layout.bounds());
322322

323-
if mouse_over {
324-
if let Some(on_toggle) = &self.on_toggle {
325-
shell.publish((on_toggle)(!self.is_checked));
326-
shell.capture_event();
327-
}
323+
if mouse_over && let Some(on_toggle) = &self.on_toggle {
324+
shell.publish((on_toggle)(!self.is_checked));
325+
shell.capture_event();
328326
}
329327
}
330328
_ => {}

0 commit comments

Comments
 (0)