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 3fd4ea6ae9
commit 126da77a37
259 files changed
+2495 -1547

No files matched your search

+9 -6
View File
@@ -12,11 +12,13 @@
//! to a field and optionally provides diagnostics, compatibility handlers,
//! a manual-parse hook and a `--help` hook.
use crate::comma_splitter::CommaSplitter;
use crate::diagnostics::{Diagnostic, DiagnosticList, Location};
use crate::formatter::EntryFormatter;
use std::fmt;
use std::io::BufRead;
use std::{fmt, io::BufRead};
use crate::{
comma_splitter::CommaSplitter,
diagnostics::{Diagnostic, DiagnosticList, Location},
formatter::EntryFormatter,
};
/// For trimming
pub const WHITESPACE: &str = " \t";
@@ -779,9 +781,10 @@ impl<R: BufRead> ArgIter for LineIterator<R> {
#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use std::io::Cursor;
use super::*;
use crate::{config_enum, config_packed, config_struct};
use std::io::Cursor;
fn parse_str<T: CliTarget>(dst: &mut T, s: &str) -> Result<(), ArgError> {
let mut it = VecIterator::from_str_args(s);
+5 -2
View File
@@ -1,9 +1,12 @@
//! A command to execute (port of `config/command.zig`).
use crate::cli_args::{ArgError, ConfigField};
use crate::formatter::EntryFormatter;
use std::fmt;
use crate::{
cli_args::{ArgError, ConfigField},
formatter::EntryFormatter,
};
/// A command to execute (argv0 and args).
///
/// A command is specified as a simple string such as "nvim a b c".
+21 -16
View File
@@ -4,22 +4,25 @@
//! invocation below with its exact name, type, default value and doc comment.
//! The doc comments are user-visible (`ghostty +show-config --docs`).
use crate::cli_args::{self, ArgError, ArgIter, CliTarget};
use crate::command::Command;
use crate::conditional::{self, Conditional};
use crate::config_enum;
use crate::diagnostics::{Diagnostic, DiagnosticList};
use crate::io::RepeatableReadableIO;
use crate::key::Key;
use crate::keybinds::Keybinds;
use crate::macros::ConfigStruct;
use crate::metric_modifier::MetricModifier;
use crate::path::{Path, RepeatablePath};
use crate::repeatable_string_map::RepeatableStringMap;
use crate::types_a::*;
use crate::types_b::*;
use std::collections::HashSet;
use crate::{
cli_args::{self, ArgError, ArgIter, CliTarget},
command::Command,
conditional::{self, Conditional},
config_enum,
diagnostics::{Diagnostic, DiagnosticList},
io::RepeatableReadableIO,
key::Key,
keybinds::Keybinds,
macros::ConfigStruct,
metric_modifier::MetricModifier,
path::{Path, RepeatablePath},
repeatable_string_map::RepeatableStringMap,
types_a::*,
types_b::*,
};
const NS_PER_S: u64 = 1_000_000_000;
const NS_PER_MS: u64 = 1_000_000;
@@ -4820,10 +4823,12 @@ impl CliTarget for Config {
clippy::assert_is_empty
)]
mod tests {
use std::io::Cursor;
use ghostty_os::TempDir;
use super::*;
use crate::cli_args::VecIterator;
use ghostty_os::TempDir;
use std::io::Cursor;
fn it(args: &[&str]) -> VecIterator {
VecIterator::new(args.iter().map(|s| (*s).to_string()).collect())
+2 -3
View File
@@ -1,9 +1,8 @@
//! Opening the config for editing (port of `config/edit.zig`).
use std::{fs::OpenOptions, io, path::Path};
use crate::file_load;
use std::fs::OpenOptions;
use std::io;
use std::path::Path;
/// The path to the configuration that should be opened for editing.
///
+6 -3
View File
@@ -1,11 +1,14 @@
//! `FileFormatter` (part of `config/formatter.zig`): outputs the config in a
//! file-like format, identical to Ghostty's `+show-config`.
use crate::config::Config;
use crate::key::Key;
use crate::macros::{ConfigStruct, help_string};
use std::fmt;
use crate::{
config::Config,
key::Key,
macros::{ConfigStruct, help_string},
};
/// FileFormatter is a formatter implementation that outputs the
/// config in a file-like format. This uses more generous whitespace,
/// can include comments, etc.
+2 -1
View File
@@ -2,9 +2,10 @@
//!
//! macOS Application Support paths are not supported (Linux only).
use ghostty_os::xdg;
use std::fs::File;
use ghostty_os::xdg;
/// Default path for the XDG home configuration file.
pub fn default_xdg_path() -> Result<String, xdg::Error> {
xdg::config(&xdg::Options {
+2 -1
View File
@@ -1,9 +1,10 @@
//! Config formatting (port of `config/formatter.zig`). Output matches
//! Ghostty's `+show-config`.
use crate::cli_args::ConfigField;
use std::fmt;
use crate::cli_args::ConfigField;
/// A single entry formatter for the given field name and writer.
pub struct EntryFormatter<'a> {
pub name: &'a str,
+7 -3
View File
@@ -1,11 +1,15 @@
//! `ConfigField` implementations for types owned by `ghostty-input`
//! (the input crate cannot depend on the config crate).
use crate::cli_args::{ArgError, ConfigField};
use crate::formatter::EntryFormatter;
use ghostty_input::{KeyRemapSet, OptionAsAlt};
use std::fmt;
use ghostty_input::{KeyRemapSet, OptionAsAlt};
use crate::{
cli_args::{ArgError, ConfigField},
formatter::EntryFormatter,
};
impl ConfigField for KeyRemapSet {
fn parse_cli(&mut self, value: Option<&str>) -> Result<(), ArgError> {
self.parse_cli(value).map_err(|_| ArgError::InvalidValue)
+6 -3
View File
@@ -1,10 +1,13 @@
//! Readable IO config values (port of `config/io.zig`).
use crate::cli_args::{ArgError, ConfigField, split_tagged_union};
use crate::formatter::EntryFormatter;
use crate::string;
use std::fmt;
use crate::{
cli_args::{ArgError, ConfigField, split_tagged_union},
formatter::EntryFormatter,
string,
};
/// ReadableIO is some kind of IO source that is readable.
///
/// It can be either a direct string or a filepath. The filepath will
+28 -10
View File
@@ -1,17 +1,35 @@
//! Keybinds (port of `Config.Keybinds` from `config/Config.zig`).
use crate::cli_args::{ArgError, ConfigField};
use crate::formatter::EntryFormatter;
use ghostty_input::binding::set::EntryFormatter as BindingEntryFormatter;
use ghostty_input::binding::set::Value;
use ghostty_input::binding::{
Action, AdjustSelection, CloseTabMode, CopyToClipboard, Flags, InspectorMode, Set,
SplitDirection, SplitFocusDirection, SplitResizeDirection, SplitResizeParameter, Trigger,
TriggerKey, WriteScreen,
};
use ghostty_input::{Key, Mods, ctrl_or_super};
use std::fmt;
use ghostty_input::{
Key,
Mods,
binding::{
Action,
AdjustSelection,
CloseTabMode,
CopyToClipboard,
Flags,
InspectorMode,
Set,
SplitDirection,
SplitFocusDirection,
SplitResizeDirection,
SplitResizeParameter,
Trigger,
TriggerKey,
WriteScreen,
set::{EntryFormatter as BindingEntryFormatter, Value},
},
ctrl_or_super,
};
use crate::{
cli_args::{ArgError, ConfigField},
formatter::EntryFormatter,
};
/// The most recent binding target for `chain=` additions.
///
/// This is intentionally tracked at the Keybinds level so that chains can
+5 -2
View File
@@ -3,10 +3,13 @@
//! The font crate depends on this crate (not the other way around), so the
//! modifier type used by the `adjust-*` config options lives here.
use crate::cli_args::{ArgError, ConfigField};
use crate::formatter::EntryFormatter;
use std::fmt;
use crate::{
cli_args::{ArgError, ConfigField},
formatter::EntryFormatter,
};
/// A modifier to apply to a metrics value. The modifier value represents
/// a delta, so percent is a percentage to change, not a percentage of.
/// For example, "20%" is 20% larger, not 20% of the value. Likewise,
+10 -5
View File
@@ -1,10 +1,15 @@
//! Path config values (port of `config/path.zig`).
use crate::cli_args::{ArgError, ConfigField};
use crate::diagnostics::{Diagnostic, DiagnosticList};
use crate::formatter::EntryFormatter;
use std::fmt;
use std::path::{Component, Path as StdPath, PathBuf};
use std::{
fmt,
path::{Component, Path as StdPath, PathBuf},
};
use crate::{
cli_args::{ArgError, ConfigField},
diagnostics::{Diagnostic, DiagnosticList},
formatter::EntryFormatter,
};
/// Path is like a string that represents a path value. The difference is that
/// when loading the configuration the value for this will be automatically
@@ -2,10 +2,13 @@
//! string map. This isn't called "StringMap" because I find that sometimes
//! leads to confusion that it _accepts_ a map such as JSON dict.
use crate::cli_args::{ArgError, ConfigField};
use crate::formatter::EntryFormatter;
use std::fmt;
use crate::{
cli_args::{ArgError, ConfigField},
formatter::EntryFormatter,
};
/// std.ascii.whitespace
fn is_ascii_ws(c: char) -> bool {
matches!(c, ' ' | '\t' | '\n' | '\r' | '\x0b' | '\x0c')
+2 -2
View File
@@ -3,9 +3,9 @@
//! Zig reads the resources dir from global state; here it is passed
//! explicitly (`resources_dir`, the value of `ResourcesDir.app()`).
use std::{fs::File, path::Path};
use crate::diagnostics::{Diagnostic, DiagnosticList};
use std::fs::File;
use std::path::Path;
/// Location of possible themes. The order of this enum matters because it
/// defines the priority of theme search (from top to bottom).
+11 -6
View File
@@ -2,14 +2,19 @@
//! enums, working directory, colors, palette, repeatable strings, word
//! chars, font variation / codepoint maps, font style, links.
use crate::cli_args::{ArgError, ConfigField, parse_int_base0, trim_ws};
use crate::clipboard_codepoint_map::{ClipboardCodepointMap, Entry as ClipboardEntry, Replacement};
use crate::font_types::{CodepointMap, CodepointMapEntry, Descriptor, Variation, VariationId};
use crate::formatter::EntryFormatter;
use crate::{config_enum, config_packed};
use ghostty_vt::color::{DEFAULT as DEFAULT_PALETTE, Palette as TermPalette, PaletteMask, Rgb};
use std::fmt;
use ghostty_vt::color::{DEFAULT as DEFAULT_PALETTE, Palette as TermPalette, PaletteMask, Rgb};
use crate::{
cli_args::{ArgError, ConfigField, parse_int_base0, trim_ws},
clipboard_codepoint_map::{ClipboardCodepointMap, Entry as ClipboardEntry, Replacement},
config_enum,
config_packed,
font_types::{CodepointMap, CodepointMapEntry, Descriptor, Variation, VariationId},
formatter::EntryFormatter,
};
/// Write `name = value\n` for a string-ish value.
fn write_str(f: &mut EntryFormatter<'_>, value: &str) -> fmt::Result {
writeln!(f.writer, "{} = {}", f.name, value)
+9 -4
View File
@@ -3,12 +3,17 @@
#![allow(clippy::format_push_string, clippy::single_match_else)]
use crate::cli_args::{ArgError, ConfigField, parse_auto_struct_with, parse_bool, trim_ws};
use crate::formatter::EntryFormatter;
use crate::{config_enum, config_packed};
use ghostty_input::binding::Action;
use std::fmt;
use ghostty_input::binding::Action;
use crate::{
cli_args::{ArgError, ConfigField, parse_auto_struct_with, parse_bool, trim_ws},
config_enum,
config_packed,
formatter::EntryFormatter,
};
/// Write `name = <s>\n` (Zig: `formatEntry([]const u8, s)`).
fn fmt_str(f: &mut EntryFormatter<'_>, s: &str) -> fmt::Result {
writeln!(f.writer, "{} = {}", f.name, s)
+2 -1
View File
@@ -116,9 +116,10 @@ pub const REGEX: &str = concatcp!(
#[cfg(test)]
#[allow(clippy::unwrap_used)]
mod tests {
use super::*;
use onig::Regex;
use super::*;
#[test]
fn url_regex() {
let re = Regex::new(REGEX).unwrap();