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

+6 -3
View File
@@ -1,5 +1,7 @@
use std::collections::HashMap;
use std::ffi::{OsStr, OsString};
use std::{
collections::HashMap,
ffi::{OsStr, OsString},
};
use crate::flatpak::is_flatpak;
@@ -214,9 +216,10 @@ pub fn getenv_not_empty(key: &str) -> Option<String> {
#[cfg(test)]
mod tests {
use super::*;
use std::os::unix::ffi::OsStringExt;
use super::*;
#[test]
fn env_map_preserves_non_utf8() {
let mut env = EnvMap::new();
+11 -6
View File
@@ -1,10 +1,15 @@
use std::collections::HashMap;
use std::os::fd::{AsFd, OwnedFd};
use std::sync::{Arc, Condvar, Mutex};
use std::{
collections::HashMap,
os::fd::{AsFd, OwnedFd},
sync::{Arc, Condvar, Mutex},
};
use zbus::blocking::{Connection, MessageIterator};
use zbus::zvariant::Fd;
use zbus::{MatchRule, message::Type as MessageType};
use zbus::{
MatchRule,
blocking::{Connection, MessageIterator},
message::Type as MessageType,
zvariant::Fd,
};
const BUS_NAME: &str = "org.freedesktop.Flatpak";
const OBJECT_PATH: &str = "/org/freedesktop/Flatpak/Development";
+10 -2
View File
@@ -48,8 +48,16 @@ pub(crate) mod testutil;
pub use dbus::launched_by_dbus_activation;
pub use desktop::{DesktopEnvironment, desktop_environment, launched_from_desktop};
pub use env::{
EnvMap, append_env, append_env_always, append_env_os, filter_snap_paths, get_env_map, getenv,
getenv_not_empty, prepend_env, prepend_env_os,
EnvMap,
append_env,
append_env_always,
append_env_os,
filter_snap_paths,
get_env_map,
getenv,
getenv_not_empty,
prepend_env,
prepend_env_os,
};
pub use file::{Rlimit, alloc_tmp_dir, fix_max_files, restore_max_files};
pub use flatpak::{FlatpakHostCommand, is_flatpak};
+4 -2
View File
@@ -1,5 +1,7 @@
use std::io;
use std::process::{Command, Stdio};
use std::{
io,
process::{Command, Stdio},
};
/// Kind of URL being opened (`apprt.action.OpenUrl.Kind`). On Linux the
/// kind is ignored by [`open`] (it only matters for macOS `open -t`).
+5 -2
View File
@@ -47,10 +47,13 @@ pub fn get() -> std::io::Result<Entry> {
/// `Pty`) depends on this crate, so a minimal openpt/ptsname pair is opened
/// here with rustix instead. Like Zig, only `shell` and `home` are filled in.
fn host_entry(name: &str) -> std::io::Result<Entry> {
use rustix::fs::{Mode, OFlags};
use rustix::pty::{OpenptFlags, grantpt, openpt, ptsname, unlockpt};
use std::io::Read;
use rustix::{
fs::{Mode, OFlags},
pty::{OpenptFlags, grantpt, openpt, ptsname, unlockpt},
};
let err = std::io::Error::from;
let master =
openpt(OpenptFlags::RDWR | OpenptFlags::NOCTTY | OpenptFlags::CLOEXEC).map_err(err)?;
+1 -2
View File
@@ -1,5 +1,4 @@
use std::io;
use std::os::unix::fs::PermissionsExt;
use std::{io, os::unix::fs::PermissionsExt};
/// Equivalent of `std.fs.max_path_bytes` on Linux.
const MAX_PATH_BYTES: usize = 4096;
+3 -3
View File
@@ -1,5 +1,4 @@
use std::io;
use std::os::fd::OwnedFd;
use std::{io, os::fd::OwnedFd};
/// pipe() for POSIX. Sets CLOEXEC on the file descriptors.
/// Returns `(read, write)`.
@@ -9,9 +8,10 @@ pub fn pipe() -> io::Result<(OwnedFd, OwnedFd)> {
#[cfg(test)]
mod tests {
use super::*;
use std::io::{Read, Write};
use super::*;
#[test]
fn pipe_roundtrip_cloexec() {
let (r, w) = pipe().unwrap();
+1 -2
View File
@@ -1,5 +1,4 @@
use std::io;
use std::path::Path;
use std::{io, path::Path};
use crate::path_join;
+4 -2
View File
@@ -1,5 +1,7 @@
use std::ffi::{CString, NulError};
use std::io::{self, Write};
use std::{
ffi::{CString, NulError},
io::{self, Write},
};
/// Builder for constructing space-separated shell command strings.
#[derive(Debug, Default, Clone)]
+4 -1
View File
@@ -4,5 +4,8 @@
//! vt cannot depend on os); this module re-exports it.
pub use ghostty_vt::string_encoding::{
Error, printf_q_decode, url_percent_decode, url_percent_encode,
Error,
printf_q_decode,
url_percent_decode,
url_percent_encode,
};
+9 -2
View File
@@ -70,7 +70,13 @@ pub fn launched_by_systemd() -> bool {
/// variable set and these functions essentially become a no-op.
pub mod notify {
use rustix::net::{
AddressFamily, SendFlags, SocketAddrUnix, SocketFlags, SocketType, connect, send,
AddressFamily,
SendFlags,
SocketAddrUnix,
SocketFlags,
SocketType,
connect,
send,
socket_with,
};
@@ -168,9 +174,10 @@ pub mod notify {
#[cfg(test)]
mod tests {
use super::*;
use std::os::unix::net::UnixDatagram;
use super::*;
#[test]
fn not_launched_without_env() {
temp_env::with_vars(
+5 -3
View File
@@ -1,9 +1,11 @@
//! Creates a temporary directory at runtime that can be safely used to
//! store temporary data and is destroyed on drop.
use std::io;
use std::os::unix::fs::DirBuilderExt;
use std::path::{Path, PathBuf};
use std::{
io,
os::unix::fs::DirBuilderExt,
path::{Path, PathBuf},
};
use crate::file::alloc_tmp_dir;
+1 -2
View File
@@ -1,8 +1,7 @@
//! URI parsing. Extends a faithful port of Zig's `std.Uri.parse` with the
//! additional [`ParseOptions`] from `os/uri.zig`.
use std::borrow::Cow;
use std::fmt::Write as _;
use std::{borrow::Cow, fmt::Write as _};
#[derive(Debug, Clone, Copy, Default)]
pub struct ParseOptions {
+1 -2
View File
@@ -3,8 +3,7 @@
use std::ffi::CStr;
use crate::env::getenv_not_empty;
use crate::{homedir, path_join};
use crate::{env::getenv_not_empty, homedir, path_join};
#[derive(Debug, Clone, Default)]
pub struct Options<'a> {