Skip to content

Commit dda4591

Browse files
committed
Update to rust 2024 edition
1 parent 927d7dd commit dda4591

File tree

159 files changed

+712
-872
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+712
-872
lines changed

editor/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
name = "graphite-editor"
33
publish = false
44
version = "0.0.0"
5-
rust-version = "1.82"
5+
rust-version = "1.85"
66
authors = ["Graphite Authors <[email protected]>"]
7-
edition = "2021"
7+
edition = "2024"
88
readme = "../README.md"
99
homepage = "https://graphite.rs"
1010
repository = "https://github.com/GraphiteEditor/Graphite"

editor/src/dispatcher.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -303,11 +303,7 @@ impl Dispatcher {
303303
fn create_indents(queues: &[VecDeque<Message>]) -> String {
304304
String::from_iter(queues.iter().enumerate().skip(1).map(|(index, queue)| {
305305
if index == queues.len() - 1 {
306-
if queue.is_empty() {
307-
"└── "
308-
} else {
309-
"├── "
310-
}
306+
if queue.is_empty() { "└── " } else { "├── " }
311307
} else if queue.is_empty() {
312308
" "
313309
} else {

editor/src/macros.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
/// ```
2626
///
2727
macro_rules! actions {
28-
($($v:expr),* $(,)?) => {{
28+
($($v:expr_2021),* $(,)?) => {{
2929
vec![$(vec![$v.into()]),*]
3030
}};
3131

@@ -42,7 +42,7 @@ macro_rules! actions {
4242
/// }
4343
/// ```
4444
macro_rules! advertise_actions {
45-
($($v:expr),* $(,)?) => {
45+
($($v:expr_2021),* $(,)?) => {
4646
fn actions(&self) -> $crate::utility_traits::ActionList {
4747
actions!($($v),*)
4848
}

editor/src/messages/dialog/simple_dialogs/coming_soon_dialog.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,18 @@ impl LayoutHolder for ComingSoonDialog {
2626

2727
if let Some(issue) = self.issue {
2828
let row2 = vec![TextLabel::new("But you can help build it! Visit its issue:").widget_holder()];
29-
let row3 = vec![TextButton::new(format!("GitHub Issue #{issue}"))
30-
.icon(Some("Website".into()))
31-
.flush(true)
32-
.on_update(move |_| {
33-
FrontendMessage::TriggerVisitLink {
34-
url: format!("https://github.com/GraphiteEditor/Graphite/issues/{issue}"),
35-
}
36-
.into()
37-
})
38-
.widget_holder()];
29+
let row3 = vec![
30+
TextButton::new(format!("GitHub Issue #{issue}"))
31+
.icon(Some("Website".into()))
32+
.flush(true)
33+
.on_update(move |_| {
34+
FrontendMessage::TriggerVisitLink {
35+
url: format!("https://github.com/GraphiteEditor/Graphite/issues/{issue}"),
36+
}
37+
.into()
38+
})
39+
.widget_holder(),
40+
];
3941

4042
rows.push(LayoutGroup::Row { widgets: row2 });
4143
rows.push(LayoutGroup::Row { widgets: row3 });

editor/src/messages/dialog/simple_dialogs/demo_artwork_dialog.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ impl LayoutHolder for DemoArtworkDialog {
3232
.flat_map(|chunk| {
3333
fn make_dialog(name: &str, filename: &str) -> Message {
3434
DialogMessage::CloseDialogAndThen {
35-
followups: vec![FrontendMessage::TriggerFetchAndOpenDocument {
36-
name: name.to_string(),
37-
filename: filename.to_string(),
38-
}
39-
.into()],
35+
followups: vec![
36+
FrontendMessage::TriggerFetchAndOpenDocument {
37+
name: name.to_string(),
38+
filename: filename.to_string(),
39+
}
40+
.into(),
41+
],
4042
}
4143
.into()
4244
}

editor/src/messages/input_mapper/utility_types/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro_rules! modifiers {
2424
/// Each handler adds or removes actions in the form of message discriminants. Here, we tie an input condition (such as a hotkey) to an action's full message.
2525
/// When an action is currently available, and the user enters that input, the action's message is dispatched on the message bus.
2626
macro_rules! entry {
27-
($input:expr; $(modifiers=[$($modifier:ident),*],)? $(refresh_keys=[$($refresh:ident),* $(,)?],)? action_dispatch=$action_dispatch:expr$(,)?) => {
27+
($input:expr_2021; $(modifiers=[$($modifier:ident),*],)? $(refresh_keys=[$($refresh:ident),* $(,)?],)? action_dispatch=$action_dispatch:expr_2021$(,)?) => {
2828
&[&[
2929
// Cause the `action_dispatch` message to be sent when the specified input occurs.
3030
MappingEntry {
@@ -72,7 +72,7 @@ macro_rules! entry {
7272
/// (key_up, key_down, double_click, wheel_scroll, pointer_move)
7373
/// ```
7474
macro_rules! mapping {
75-
[$($entry:expr),* $(,)?] => {{
75+
[$($entry:expr_2021),* $(,)?] => {{
7676
let mut key_up = KeyMappingEntries::key_array();
7777
let mut key_down = KeyMappingEntries::key_array();
7878
let mut key_up_no_repeat = KeyMappingEntries::key_array();
@@ -107,7 +107,7 @@ macro_rules! mapping {
107107

108108
/// Constructs an `ActionKeys` macro with a certain `Action` variant, conveniently wrapped in `Some()`.
109109
macro_rules! action_keys {
110-
($action:expr) => {
110+
($action:expr_2021) => {
111111
Some(crate::messages::input_mapper::utility_types::misc::ActionKeys::Action($action.into()))
112112
};
113113
}

editor/src/messages/input_mapper/utility_types/misc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::input_keyboard::{all_required_modifiers_pressed, Key, KeysGroup, LayoutKeysGroup};
1+
use super::input_keyboard::{Key, KeysGroup, LayoutKeysGroup, all_required_modifiers_pressed};
22
use crate::messages::input_mapper::key_mapping::MappingVariant;
33
use crate::messages::input_mapper::utility_types::input_keyboard::{KeyStates, NUMBER_OF_KEYS};
44
use crate::messages::input_mapper::utility_types::input_mouse::NUMBER_OF_MOUSE_BUTTONS;

editor/src/messages/layout/utility_types/layout_widget.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,7 @@ impl LayoutGroup {
348348
val.clone_from(&tooltip);
349349
}
350350
}
351-
if is_col {
352-
Self::Column { widgets }
353-
} else {
354-
Self::Row { widgets }
355-
}
351+
if is_col { Self::Column { widgets } } else { Self::Row { widgets } }
356352
}
357353

358354
/// Diffing updates self (where self is old) based on new, updating the list of modifications as it does so.

editor/src/messages/layout/utility_types/widgets/input_widgets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::messages::input_mapper::utility_types::misc::ActionKeys;
22
use crate::messages::layout::utility_types::widget_prelude::*;
33

4-
use graphene_core::{raster::curve::Curve, Color};
4+
use graphene_core::{Color, raster::curve::Curve};
55
use graphite_proc_macros::WidgetBuilder;
66

77
use derivative::*;

editor/src/messages/portfolio/document/document_message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use crate::messages::portfolio::utility_types::PanelType;
77
use crate::messages::prelude::*;
88

99
use graph_craft::document::NodeId;
10+
use graphene_core::Color;
1011
use graphene_core::raster::BlendMode;
1112
use graphene_core::raster::Image;
1213
use graphene_core::vector::style::ViewMode;
13-
use graphene_core::Color;
1414
use graphene_std::renderer::ClickTarget;
1515
use graphene_std::transform::Footprint;
1616

0 commit comments

Comments
 (0)