chore: Rust 2024 edition

This commit is contained in:
Vukašin Vojinović 2025-09-10 13:36:02 +02:00
parent cd8ac14f79
commit e405b929c1
8 changed files with 52 additions and 49 deletions

View file

@ -2,9 +2,9 @@
name = "cosmic-edit"
version = "0.1.0"
authors = ["Jeremy Soller <jeremy@system76.com>"]
edition = "2021"
edition = "2024"
license = "GPL-3.0-only"
rust-version = "1.71"
rust-version = "1.85"
[build-dependencies]
vergen = { version = "8", features = ["git", "gitcl"] }

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::{
cosmic_config::{self, cosmic_config_derive::CosmicConfigEntry, CosmicConfigEntry},
cosmic_config::{self, CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry},
theme,
};
use cosmic_text::Metrics;

View file

@ -4,8 +4,8 @@ use std::str::FromStr;
use std::sync::OnceLock;
use i18n_embed::{
fluent::{fluent_language_loader, FluentLanguageLoader},
DefaultLocalizer, LanguageLoader, Localizer,
fluent::{FluentLanguageLoader, fluent_language_loader},
};
use icu_collator::{Collator, CollatorOptions, Numeric};
use icu_provider::DataLocale;

View file

@ -5,22 +5,21 @@ use cosmic::widget::menu::action::MenuAction;
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::segmented_button::Entity;
use cosmic::{
action,
app::{context_drawer, Core, Settings, Task},
Application, ApplicationExt, Apply, Element, action,
app::{Core, Settings, Task, context_drawer},
cosmic_config::{self, CosmicConfigEntry},
cosmic_theme, executor,
font::Font,
iced::{
self,
self, Alignment, Background, Color, Length, Limits, Point, Subscription,
advanced::graphics::text::font_system,
clipboard, event,
futures::{self, SinkExt},
keyboard::{self, Modifiers},
stream, window, Alignment, Background, Color, Length, Limits, Point, Subscription,
stream, window,
},
style, theme,
widget::{self, button, icon, nav_bar, segmented_button},
Application, ApplicationExt, Apply, Element,
};
use cosmic_files::{
dialog::{Dialog, DialogKind, DialogMessage, DialogResult, DialogSettings},
@ -38,7 +37,7 @@ use std::{
};
use tokio::time;
use config::{AppTheme, Config, ConfigState, CONFIG_VERSION};
use config::{AppTheme, CONFIG_VERSION, Config, ConfigState};
mod config;
use git::{GitDiff, GitDiffLine, GitRepository, GitStatus, GitStatusKind};
@ -911,24 +910,26 @@ impl App {
});
}
widget::settings::view_column(vec![widget::settings::section()
.add(
widget::settings::item::builder(fl!("word-count"))
.control(widget::text(word_count.to_string())),
)
.add(
widget::settings::item::builder(fl!("character-count"))
.control(widget::text(character_count.to_string())),
)
.add(
widget::settings::item::builder(fl!("character-count-no-spaces"))
.control(widget::text(character_count_no_spaces.to_string())),
)
.add(
widget::settings::item::builder(fl!("line-count"))
.control(widget::text(line_count.to_string())),
)
.into()])
widget::settings::view_column(vec![
widget::settings::section()
.add(
widget::settings::item::builder(fl!("word-count"))
.control(widget::text(word_count.to_string())),
)
.add(
widget::settings::item::builder(fl!("character-count"))
.control(widget::text(character_count.to_string())),
)
.add(
widget::settings::item::builder(fl!("character-count-no-spaces"))
.control(widget::text(character_count_no_spaces.to_string())),
)
.add(
widget::settings::item::builder(fl!("line-count"))
.control(widget::text(line_count.to_string())),
)
.into(),
])
.into()
}
@ -1182,10 +1183,12 @@ impl App {
items
}
None => {
vec![search_input
.on_input(Message::ProjectSearchValue)
.on_submit(|_| Message::ProjectSearchSubmit)
.into()]
vec![
search_input
.on_input(Message::ProjectSearchValue)
.on_submit(|_| Message::ProjectSearchSubmit)
.into(),
]
}
};

View file

@ -1,22 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::menu::Item as MenuItem;
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::{
Element,
app::Core,
iced::{advanced::widget::text::Style as TextStyle, widget::column, Background, Length},
iced::{Background, Length, advanced::widget::text::Style as TextStyle, widget::column},
iced_core::Border,
theme,
widget::{
self, divider, horizontal_space,
menu::{menu_button, ItemHeight, ItemWidth},
menu::{ItemHeight, ItemWidth, menu_button},
responsive_menu_bar, segmented_button,
},
Element,
};
use std::{collections::HashMap, path::PathBuf, sync::LazyLock};
use crate::{fl, Action, Config, ConfigState, Message};
use crate::{Action, Config, ConfigState, Message, fl};
static MENU_ID: LazyLock<cosmic::widget::Id> =
LazyLock::new(|| cosmic::widget::Id::new("responsive-menu"));

View file

@ -2,7 +2,7 @@
use grep::matcher::{Match, Matcher};
use grep::regex::RegexMatcher;
use grep::searcher::{sinks::UTF8, Searcher};
use grep::searcher::{Searcher, sinks::UTF8};
use std::path::PathBuf;
#[derive(Clone, Debug, Eq, PartialEq)]

View file

@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::{
iced::{advanced::graphics::text::font_system, Point},
iced::{Point, advanced::graphics::text::font_system},
widget::icon,
};
use cosmic_files::mime_icon::{mime_for_path, mime_icon, FALLBACK_MIME_ICON};
use cosmic_files::mime_icon::{FALLBACK_MIME_ICON, mime_for_path, mime_icon};
use cosmic_text::{Attrs, Buffer, Cursor, Edit, Selection, Shaping, SyntaxEditor, ViEditor, Wrap};
use notify::Watcher;
use regex::Regex;
@ -16,7 +16,7 @@ use std::{
sync::{Arc, Mutex},
};
use crate::{fl, git::GitDiff, Config, SYNTAX_SYSTEM};
use crate::{Config, SYNTAX_SYSTEM, fl, git::GitDiff};
pub enum Tab {
Editor(EditorTab),

View file

@ -1,29 +1,29 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::{
cosmic_theme::palette::{blend::Compose, WithAlpha},
Renderer,
cosmic_theme::palette::{WithAlpha, blend::Compose},
iced::{
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
advanced::graphics::text::font_system,
event::{Event, Status},
keyboard::{Event as KeyEvent, Modifiers},
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
},
iced_core::{
Border, Radians, Shell,
clipboard::Clipboard,
image,
keyboard::{key::Named, Key},
keyboard::{Key, key::Named},
layout::{self, Layout},
renderer::{self, Quad, Renderer as _},
widget::{
self,
self, Id, Widget,
operation::{self, Operation},
tree, Id, Widget,
tree,
},
Border, Radians, Shell,
},
theme::Theme,
Renderer,
};
use cosmic_text::{
Action, BorrowedWithFontSystem, Edit, Metrics, Motion, Scroll, Selection, ViEditor,
@ -35,7 +35,7 @@ use std::{
time::{Duration, Instant},
};
use crate::{line_number::LineNumberKey, LINE_NUMBER_CACHE, SWASH_CACHE};
use crate::{LINE_NUMBER_CACHE, SWASH_CACHE, line_number::LineNumberKey};
pub struct TextBox<'a, Message> {
editor: &'a Mutex<ViEditor<'static, 'static>>,