style: apply nightly rustfmt import grouping across the workspace

rustfmt.toml sets group_imports, imports_granularity and imports_layout,
which are nightly-only; agents formatted with stable rustfmt, which
ignored them. This is a formatting-only pass with `cargo +nightly fmt`.

Test Plan:
- cargo clippy --workspace --all-targets -- -D warnings
- cargo test --workspace
This commit is contained in:
ddidderr committed 2026-10-12 05:03:37 +02:00
1 parent 81d4119d85
commit 8bcb85a29a
259 files changed
+2495 -1547

No files matched your search

+2 -1
View File
@@ -104,9 +104,10 @@ where
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
use super::*;
use ghostty_config::cli_args::split_args;
use super::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
enum Plain {
Foo,
+11 -8
View File
@@ -5,17 +5,20 @@
//! joined with `\x01` and raw-deflate compressed into `boo_frames.deflate`
//! (the same format `framegen` produces for Zig's `framedata`).
use std::io::Read;
use std::time::{Duration, Instant};
use std::{
io::Read,
time::{Duration, Instant},
};
use flate2::read::DeflateDecoder;
use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{self, Event, KeyCode, KeyEventKind, KeyModifiers};
use ratatui::layout::Rect;
use ratatui::style::{Color, Style};
use ratatui::{
buffer::Buffer,
crossterm::event::{self, Event, KeyCode, KeyEventKind, KeyModifiers},
layout::Rect,
style::{Color, Style},
};
use crate::error::Error;
use crate::options::NoOptions as Options;
use crate::{error::Error, options::NoOptions as Options};
static FRAME_DATA: &[u8] = include_bytes!("boo_frames.deflate");
+5 -4
View File
@@ -4,14 +4,15 @@
//! Ghostty uses sentry for crash reporting; only the listing behaviour is
//! ported.
use std::io::{IsTerminal, Write};
use std::path::PathBuf;
use std::time::{SystemTime, UNIX_EPOCH};
use std::{
io::{IsTerminal, Write},
path::PathBuf,
time::{SystemTime, UNIX_EPOCH},
};
use ghostty_config::types_b::Duration;
use crate::error::Error;
pub use crate::options::NoOptions as Options;
/// A crash report file (Zig: `crash.Report`).
+1 -3
View File
@@ -1,12 +1,10 @@
//! `+edit-config` (ZIG/src/cli/edit_config.zig).
use std::io::Write;
use std::os::unix::process::CommandExt;
use std::{io::Write, os::unix::process::CommandExt};
use ghostty_config::config::Config;
use crate::error::Error;
pub use crate::options::NoOptions as Options;
/// The `edit-config` command opens the Ghostty configuration file in the
+7 -5
View File
@@ -3,8 +3,10 @@
use std::io::Write;
use crate::action::{ActionEnum, DetectError, SpecialCase, detect_iter};
use crate::error::Error;
use crate::{
action::{ActionEnum, DetectError, SpecialCase, detect_iter},
error::Error,
};
/// Special commands that can be invoked via CLI flags. These are all
/// invoked by using `+<action>` as a CLI flag. The only exception is
@@ -117,8 +119,7 @@ impl Action {
/// Used by the build-data generator for shell completions.
#[must_use]
pub fn option_fields(self) -> Vec<(&'static str, ghostty_config::cli_args::FieldKind)> {
use ghostty_config::cli_args::FieldKind;
use ghostty_config::macros::ConfigStruct;
use ghostty_config::{cli_args::FieldKind, macros::ConfigStruct};
fn of<T: ConfigStruct>() -> Vec<(&'static str, FieldKind)> {
T::FIELDS
.iter()
@@ -297,9 +298,10 @@ pub fn run_from_args(args: &[String]) -> Option<u8> {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
use super::*;
use ghostty_config::cli_args::split_args;
use super::*;
fn detect_str(s: &str) -> Result<Option<Action>, DetectError> {
detect_iter::<Action, _, _>(split_args(s))
}
+1 -2
View File
@@ -4,8 +4,7 @@ use std::io::Write;
use ghostty_config::config_struct;
use crate::error::Error;
use crate::ghostty::Action;
use crate::{error::Error, ghostty::Action};
config_struct! {
// Note that this options struct doesn't implement the `help` decl like other
+8 -4
View File
@@ -1,12 +1,16 @@
//! `+list-colors` (ZIG/src/cli/list_colors.zig).
use std::cmp::Ordering;
use std::io::{IsTerminal, Write};
use std::{
cmp::Ordering,
io::{IsTerminal, Write},
};
use ghostty_config::config_struct;
use crate::error::Error;
use crate::tui::{self, Color, PrettySession, Style};
use crate::{
error::Error,
tui::{self, Color, PrettySession, Style},
};
config_struct! {
pub struct Options {
+1 -2
View File
@@ -49,8 +49,7 @@ pub fn run(args: &[String]) -> Result<u8, Error> {
let mut opts = Options::default();
crate::parse_options(&mut opts, args)?;
use std::collections::HashMap;
use std::io::Write;
use std::{collections::HashMap, io::Write};
// We'll be putting our fonts into a list categorized by family
// so it is easier to read the output.
+20 -10
View File
@@ -1,18 +1,28 @@
//! `+list-keybinds` (ZIG/src/cli/list_keybinds.zig), including its pretty
//! (tty) output.
use std::cmp::Ordering;
use std::io::{IsTerminal, Write};
use std::{
cmp::Ordering,
io::{IsTerminal, Write},
};
use ghostty_config::config::Config;
use ghostty_config::config_struct;
use ghostty_config::formatter::EntryFormatter;
use ghostty_config::keybinds::Keybinds;
use ghostty_input::binding::set::{Set, Value};
use ghostty_input::binding::{Action as BindingAction, Trigger, TriggerKey};
use ghostty_config::{
config::Config,
config_struct,
formatter::EntryFormatter,
keybinds::Keybinds,
};
use ghostty_input::binding::{
Action as BindingAction,
Trigger,
TriggerKey,
set::{Set, Value},
};
use crate::error::Error;
use crate::tui::{self, Color, PrettySession, Style, gwidth};
use crate::{
error::Error,
tui::{self, Color, PrettySession, Style, gwidth},
};
config_struct! {
pub struct Options {
+12 -8
View File
@@ -3,16 +3,20 @@
//! The non-interactive listing is a faithful port. The interactive preview
//! (libvaxis in Zig) is implemented with ratatui + crossterm in [`preview`].
use std::cmp::Ordering;
use std::fmt::Write as _;
use std::io::{IsTerminal, Write};
use std::{
cmp::Ordering,
fmt::Write as _,
io::{IsTerminal, Write},
};
use ghostty_config::config::Config;
use ghostty_config::theme::{Location, LocationIterator};
use ghostty_config::{config_enum, config_struct};
use ghostty_config::{
config::Config,
config_enum,
config_struct,
theme::{Location, LocationIterator},
};
use crate::error::Error;
use crate::tui;
use crate::{error::Error, tui};
pub mod preview;
+30 -17
View File
@@ -13,22 +13,32 @@
//! termina cannot parse); it starts as light
//! like the Zig code does, but `COLORFGBG` is used as a hint if set.
use std::cell::RefCell;
use std::fmt::Write as _;
use std::io::Write;
use std::{cell::RefCell, fmt::Write as _, io::Write};
use ghostty_config::config::Config;
use ghostty_config::types_a::TerminalColor;
use ratatui::Frame;
use ratatui::buffer::Buffer;
use ratatui::crossterm::event::{
Event, KeyCode, KeyEvent, KeyEventKind, KeyModifiers, MouseButton, MouseEvent, MouseEventKind,
use ghostty_config::{config::Config, types_a::TerminalColor};
use ratatui::{
Frame,
buffer::Buffer,
crossterm::event::{
Event,
KeyCode,
KeyEvent,
KeyEventKind,
KeyModifiers,
MouseButton,
MouseEvent,
MouseEventKind,
},
layout::{Position, Rect},
style::{Color, Modifier, Style},
};
use ratatui::layout::{Position, Rect};
use ratatui::style::{Color, Modifier, Style};
use super::{
ColorScheme, SMALL_LIST_THRESHOLD, ThemeListElement, absolute_path, should_include_theme,
ColorScheme,
SMALL_LIST_THRESHOLD,
ThemeListElement,
absolute_path,
should_include_theme,
};
use crate::error::Error;
@@ -1667,10 +1677,12 @@ pub fn preview(themes: Vec<ThemeListElement>, theme_filter: ColorScheme) -> Resu
}
fn run_loop(app: &mut Preview) -> Result<(), Error> {
use ratatui::Terminal as RatTerminal;
use ratatui::backend::CrosstermBackend;
use termina::escape::csi::{Csi, DecPrivateMode, DecPrivateModeCode, Mode};
use termina::{PlatformTerminal, Terminal as _};
use ratatui::{Terminal as RatTerminal, backend::CrosstermBackend};
use termina::{
PlatformTerminal,
Terminal as _,
escape::csi::{Csi, DecPrivateMode, DecPrivateModeCode, Mode},
};
let mut tty = PlatformTerminal::new()?;
tty.enter_raw_mode()?;
@@ -1753,9 +1765,10 @@ fn draw_frame(app: &mut Preview, f: &mut Frame<'_>) -> Option<Position> {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
use super::*;
use ghostty_config::theme::Location;
use super::*;
fn make_themes(dir: &std::path::Path, names: &[(&str, &str)]) -> Vec<ThemeListElement> {
names
.iter()
+2 -1
View File
@@ -237,9 +237,10 @@ pub fn run(args: &[String]) -> Result<u8, Error> {
#[cfg(test)]
mod tests {
#![allow(clippy::unwrap_used)]
use super::*;
use ghostty_config::cli_args::{VecIterator, parse};
use super::*;
fn parse_str(s: &str) -> Options {
let mut opts = Options::default();
let mut it = VecIterator::from_str_args(s);
+1 -3
View File
@@ -2,9 +2,7 @@
use std::io::Write;
use ghostty_config::config::Config;
use ghostty_config::config_struct;
use ghostty_config::file_formatter::FileFormatter;
use ghostty_config::{config::Config, config_struct, file_formatter::FileFormatter};
use crate::error::Error;
+14 -8
View File
@@ -1,13 +1,19 @@
//! `+show-face` (ZIG/src/cli/show_face.zig).
use ghostty_config::config::Config;
use ghostty_config::diagnostics::Location;
use ghostty_config::{config_enum, config_struct, diagnostics::DiagnosticList};
use ghostty_font::collection::EntryError;
use ghostty_font::collection::GetFaceError;
use ghostty_font::face::DesiredSize;
use ghostty_font::shared_grid_set::DerivedConfig;
use ghostty_font::{self as font, SharedGrid, SharedGridSet};
use ghostty_config::{
config::Config,
config_enum,
config_struct,
diagnostics::{DiagnosticList, Location},
};
use ghostty_font::{
self as font,
SharedGrid,
SharedGridSet,
collection::{EntryError, GetFaceError},
face::DesiredSize,
shared_grid_set::DerivedConfig,
};
use crate::error::Error;
@@ -2,12 +2,14 @@
//! (ZIG/src/cli/ssh-cache/DiskCache.zig). The cache only stores metadata
//! (hostname, terminfo value, etc.) and does not store any sensitive data.
use std::collections::BTreeMap;
use std::fs::{File, OpenOptions};
use std::io::{Read, Write};
use std::net::Ipv6Addr;
use std::os::unix::fs::{OpenOptionsExt, PermissionsExt};
use std::path::PathBuf;
use std::{
collections::BTreeMap,
fs::{File, OpenOptions},
io::{Read, Write},
net::Ipv6Addr,
os::unix::fs::{OpenOptionsExt, PermissionsExt},
path::PathBuf,
};
use super::entry::{Entry, now_timestamp};
+4 -2
View File
@@ -2,8 +2,10 @@
//! Our SSH entry cache stores which hosts we've sent our terminfo to so that
//! we don't have to send it again. It doesn't store any sensitive information.
use std::fmt::Write as _;
use std::time::{SystemTime, UNIX_EPOCH};
use std::{
fmt::Write as _,
time::{SystemTime, UNIX_EPOCH},
};
const S_PER_DAY: i64 = 86_400;
+1 -2
View File
@@ -2,8 +2,7 @@
use std::io::Write;
use ghostty_config::config::Config;
use ghostty_config::config_struct;
use ghostty_config::{config::Config, config_struct};
use crate::error::Error;
+4 -2
View File
@@ -2,8 +2,10 @@
use std::io::{IsTerminal, Write};
use crate::build_info::{self, BuildInfo};
use crate::error::Error;
use crate::{
build_info::{self, BuildInfo},
error::Error,
};
/// The `version` command is used to display information about Ghostty. Recognized as
/// either `+version` or `--version`.