From 092dcf70d8bfb0e8b22a047b9f4b6451a8cf04dc Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Sat, 5 Sep 2026 14:31:29 +0100 Subject: [PATCH] style: Add newline after inner attribute for readability (#8130) Add a newline after inner attributes to make it clear that the attribute applies to the enclosing item rather than the following item. --- bidi/src/lib.rs | 1 + codec/src/lib.rs | 1 + deps/freetype/regenerate.sh | 4 +++- deps/freetype/src/lib.rs | 2 ++ procinfo/src/linux.rs | 1 + procinfo/src/macos.rs | 1 + procinfo/src/windows.rs | 1 + term/src/screen.rs | 1 + term/src/terminalstate/mod.rs | 1 + termwiz/examples/widgets_basic.rs | 2 ++ termwiz/src/widgets/mod.rs | 3 --- vtparse/src/lib.rs | 2 ++ wezterm-cell/src/color.rs | 1 + wezterm-cell/src/lib.rs | 4 +++- wezterm-char-props/src/lib.rs | 1 + wezterm-dynamic/src/lib.rs | 1 + wezterm-escape-parser/src/lib.rs | 10 ++++++---- wezterm-escape-parser/src/parser/mod.rs | 1 + wezterm-font/src/fcwrap.rs | 1 + wezterm-gui/src/selection.rs | 1 + wezterm-gui/src/termwindow/box_model.rs | 1 + wezterm-gui/src/termwindow/mod.rs | 1 + wezterm-mux-server/src/daemonize.rs | 1 + wezterm-surface/src/lib.rs | 1 + wezterm-toast-notification/src/dbus.rs | 3 ++- wezterm-toast-notification/src/macos.rs | 1 + window/src/os/macos/keycodes.rs | 1 + window/src/os/macos/mod.rs | 1 + window/src/os/x11/mod.rs | 1 + window/src/os/x11/xcb_util.rs | 1 + window/src/os/xdg_desktop_portal.rs | 4 ++-- 31 files changed, 44 insertions(+), 12 deletions(-) diff --git a/bidi/src/lib.rs b/bidi/src/lib.rs index 4029269e8..384084667 100644 --- a/bidi/src/lib.rs +++ b/bidi/src/lib.rs @@ -1,4 +1,5 @@ #![no_std] + use alloc::borrow::Cow; use core::ops::Range; use level::MAX_DEPTH; diff --git a/codec/src/lib.rs b/codec/src/lib.rs index 7869a47bd..0c230e955 100644 --- a/codec/src/lib.rs +++ b/codec/src/lib.rs @@ -8,6 +8,7 @@ //! client and server instances that are built from different versions //! of this code; in this way the client and server can more gracefully //! manage unknown enum variants. + #![allow(dead_code)] #![allow(clippy::range_plus_one)] diff --git a/deps/freetype/regenerate.sh b/deps/freetype/regenerate.sh index f7cf8e402..296984e86 100755 --- a/deps/freetype/regenerate.sh +++ b/deps/freetype/regenerate.sh @@ -19,8 +19,10 @@ bindgen bindings.h -o src/lib.rs \ --raw-line "#![allow(non_upper_case_globals)]" \ --raw-line "#![allow(clippy::unreadable_literal)]" \ --raw-line "#![allow(clippy::upper_case_acronyms)]" \ - --raw-line "mod types;" \ + --raw-line "" \ --raw-line "mod fixed_point;" \ + --raw-line "mod types;" \ + --raw-line "" \ --raw-line "pub use fixed_point::*;" \ --raw-line "pub type FT_Int16 = i16;" \ --raw-line "pub type FT_UInt16 = u16;" \ diff --git a/deps/freetype/src/lib.rs b/deps/freetype/src/lib.rs index 476412d88..71788122f 100644 --- a/deps/freetype/src/lib.rs +++ b/deps/freetype/src/lib.rs @@ -5,8 +5,10 @@ #![allow(non_upper_case_globals)] #![allow(clippy::unreadable_literal)] #![allow(clippy::upper_case_acronyms)] + mod fixed_point; mod types; + pub use fixed_point::*; pub type FT_Int16 = i16; pub type FT_UInt16 = u16; diff --git a/procinfo/src/linux.rs b/procinfo/src/linux.rs index 89f30833b..3ad7e4c14 100644 --- a/procinfo/src/linux.rs +++ b/procinfo/src/linux.rs @@ -1,4 +1,5 @@ #![cfg(target_os = "linux")] + use super::*; impl From<&str> for LocalProcessStatus { diff --git a/procinfo/src/macos.rs b/procinfo/src/macos.rs index 39343b6b5..20a16953d 100644 --- a/procinfo/src/macos.rs +++ b/procinfo/src/macos.rs @@ -1,4 +1,5 @@ #![cfg(target_os = "macos")] + use super::*; use std::ffi::{OsStr, OsString}; use std::os::unix::ffi::{OsStrExt, OsStringExt}; diff --git a/procinfo/src/windows.rs b/procinfo/src/windows.rs index bb788ce2d..9f6c24a89 100644 --- a/procinfo/src/windows.rs +++ b/procinfo/src/windows.rs @@ -1,4 +1,5 @@ #![cfg(windows)] + use super::*; use ntapi::ntpebteb::PEB; use ntapi::ntpsapi::{ diff --git a/term/src/screen.rs b/term/src/screen.rs index fcbef3baf..4c52d3783 100644 --- a/term/src/screen.rs +++ b/term/src/screen.rs @@ -1,4 +1,5 @@ #![allow(clippy::range_plus_one)] + use super::*; use crate::config::BidiMode; use log::debug; diff --git a/term/src/terminalstate/mod.rs b/term/src/terminalstate/mod.rs index ac2a60220..cda3c0f0a 100644 --- a/term/src/terminalstate/mod.rs +++ b/term/src/terminalstate/mod.rs @@ -1,6 +1,7 @@ // The range_plus_one lint can't see when the LHS is not compatible with // and inclusive range #![allow(clippy::range_plus_one)] + use super::*; use crate::color::{ColorPalette, RgbColor}; use crate::config::{BidiMode, NewlineCanon}; diff --git a/termwiz/examples/widgets_basic.rs b/termwiz/examples/widgets_basic.rs index 47bdc43c6..57b6861bf 100644 --- a/termwiz/examples/widgets_basic.rs +++ b/termwiz/examples/widgets_basic.rs @@ -1,6 +1,8 @@ //! This example shows how to make a basic widget that accumulates //! text input and renders it to the screen + #![allow(unused)] + use termwiz::caps::Capabilities; use termwiz::cell::AttributeChange; use termwiz::color::{AnsiColor, ColorAttribute}; diff --git a/termwiz/src/widgets/mod.rs b/termwiz/src/widgets/mod.rs index 9f232429e..0a077f9a7 100644 --- a/termwiz/src/widgets/mod.rs +++ b/termwiz/src/widgets/mod.rs @@ -1,6 +1,3 @@ -// Ideally this would be scoped to WidgetId, but I can't seem to find the -// right place for it to take effect -#![allow(clippy::new_without_default)] use crate::color::ColorAttribute; use crate::input::InputEvent; use crate::surface::{Change, CursorShape, CursorVisibility, Position, SequenceNo, Surface}; diff --git a/vtparse/src/lib.rs b/vtparse/src/lib.rs index 5a1115f49..c4852e1f8 100644 --- a/vtparse/src/lib.rs +++ b/vtparse/src/lib.rs @@ -10,8 +10,10 @@ //! You may wish to use `termwiz::escape::parser::Parser` in the //! [termwiz](https://docs.rs/termwiz/) crate if you don't want to have to research //! all those possible escape sequences for yourself. + #![allow(clippy::upper_case_acronyms)] #![cfg_attr(not(feature = "std"), no_std)] + use utf8parse::Parser as Utf8Parser; mod enums; use crate::enums::*; diff --git a/wezterm-cell/src/color.rs b/wezterm-cell/src/color.rs index bebc964ac..f7945dc11 100644 --- a/wezterm-cell/src/color.rs +++ b/wezterm-cell/src/color.rs @@ -1,4 +1,5 @@ //! Colors for attributes + // for FromPrimitive #![allow(clippy::useless_attribute)] diff --git a/wezterm-cell/src/lib.rs b/wezterm-cell/src/lib.rs index 5452009c8..2c293ab95 100644 --- a/wezterm-cell/src/lib.rs +++ b/wezterm-cell/src/lib.rs @@ -1,5 +1,7 @@ -#![cfg_attr(not(feature = "std"), no_std)] //! Model a cell in the terminal display + +#![cfg_attr(not(feature = "std"), no_std)] + use crate::color::{ColorAttribute, PaletteIndex}; #[cfg(feature = "use_image")] use crate::image::ImageCell; diff --git a/wezterm-char-props/src/lib.rs b/wezterm-char-props/src/lib.rs index e0960a49c..7a12ce996 100644 --- a/wezterm-char-props/src/lib.rs +++ b/wezterm-char-props/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] + pub mod emoji; pub mod emoji_presentation; pub mod emoji_variation; diff --git a/wezterm-dynamic/src/lib.rs b/wezterm-dynamic/src/lib.rs index a659f1a80..97c21c699 100644 --- a/wezterm-dynamic/src/lib.rs +++ b/wezterm-dynamic/src/lib.rs @@ -3,6 +3,7 @@ #![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), macro_use)] + extern crate alloc; mod array; diff --git a/wezterm-escape-parser/src/lib.rs b/wezterm-escape-parser/src/lib.rs index 2b35b0e0f..50f83662f 100644 --- a/wezterm-escape-parser/src/lib.rs +++ b/wezterm-escape-parser/src/lib.rs @@ -1,12 +1,14 @@ +//! This module provides the ability to parse escape sequences and attach +//! semantic meaning to them. It can also encode the semantic values as +//! escape sequences. It provides encoding and decoding functionality +//! only; it does not provide terminal emulation facilities itself. + // suppress inscrutable useless_attribute clippy that shows up when // using derive(FromPrimitive) #![allow(clippy::useless_attribute)] #![allow(clippy::upper_case_acronyms)] #![cfg_attr(not(feature = "std"), no_std)] -//! This module provides the ability to parse escape sequences and attach -//! semantic meaning to them. It can also encode the semantic values as -//! escape sequences. It provides encoding and decoding functionality -//! only; it does not provide terminal emulation facilities itself. + #[cfg(feature = "tmux_cc")] use crate::tmux_cc::Event; use core::fmt::{Display, Formatter, Result as FmtResult, Write as FmtWrite}; diff --git a/wezterm-escape-parser/src/parser/mod.rs b/wezterm-escape-parser/src/parser/mod.rs index 9129764df..650923f62 100644 --- a/wezterm-escape-parser/src/parser/mod.rs +++ b/wezterm-escape-parser/src/parser/mod.rs @@ -1,4 +1,5 @@ #![allow(clippy::many_single_char_names)] + #[cfg(feature = "tmux_cc")] use crate::tmux_cc::Event; use crate::{ diff --git a/wezterm-font/src/fcwrap.rs b/wezterm-font/src/fcwrap.rs index 59902041c..928d8ac6d 100644 --- a/wezterm-font/src/fcwrap.rs +++ b/wezterm-font/src/fcwrap.rs @@ -1,4 +1,5 @@ //! Slightly higher level helper for fontconfig + #![allow(clippy::mutex_atomic)] use anyhow::{anyhow, ensure, Error}; diff --git a/wezterm-gui/src/selection.rs b/wezterm-gui/src/selection.rs index 53b2d62b3..c822482a9 100644 --- a/wezterm-gui/src/selection.rs +++ b/wezterm-gui/src/selection.rs @@ -1,6 +1,7 @@ // The range_plus_one lint can't see when the LHS is not compatible with // and inclusive range #![allow(clippy::range_plus_one)] + use mux::pane::Pane; use std::cmp::Ordering; use std::ops::Range; diff --git a/wezterm-gui/src/termwindow/box_model.rs b/wezterm-gui/src/termwindow/box_model.rs index feba448f5..abb3b24db 100644 --- a/wezterm-gui/src/termwindow/box_model.rs +++ b/wezterm-gui/src/termwindow/box_model.rs @@ -1,4 +1,5 @@ #![allow(dead_code)] + use crate::color::LinearRgba; use crate::customglyph::{BlockKey, Poly}; use crate::glyphcache::CachedGlyph; diff --git a/wezterm-gui/src/termwindow/mod.rs b/wezterm-gui/src/termwindow/mod.rs index d0f0ff972..27567d9dd 100644 --- a/wezterm-gui/src/termwindow/mod.rs +++ b/wezterm-gui/src/termwindow/mod.rs @@ -1,4 +1,5 @@ #![allow(clippy::range_plus_one)] + use super::renderstate::*; use super::utilsprites::RenderMetrics; use crate::colorease::ColorEase; diff --git a/wezterm-mux-server/src/daemonize.rs b/wezterm-mux-server/src/daemonize.rs index ba4e7db03..fc373f8b6 100644 --- a/wezterm-mux-server/src/daemonize.rs +++ b/wezterm-mux-server/src/daemonize.rs @@ -1,4 +1,5 @@ #![cfg(unix)] + use anyhow::Context; use libc::pid_t; use std::io::Write; diff --git a/wezterm-surface/src/lib.rs b/wezterm-surface/src/lib.rs index 2c4fc904b..244a64529 100644 --- a/wezterm-surface/src/lib.rs +++ b/wezterm-surface/src/lib.rs @@ -1,4 +1,5 @@ #![cfg_attr(not(feature = "std"), no_std)] + use crate::line::CellRef; use alloc::borrow::Cow; use core::cmp::min; diff --git a/wezterm-toast-notification/src/dbus.rs b/wezterm-toast-notification/src/dbus.rs index 55d985cf2..71b8b3e3a 100644 --- a/wezterm-toast-notification/src/dbus.rs +++ b/wezterm-toast-notification/src/dbus.rs @@ -1,6 +1,7 @@ -#![cfg(all(not(target_os = "macos"), not(windows)))] //! See +#![cfg(all(not(target_os = "macos"), not(windows)))] + use crate::ToastNotification; use futures_util::stream::{abortable, StreamExt}; use serde::{Deserialize, Serialize}; diff --git a/wezterm-toast-notification/src/macos.rs b/wezterm-toast-notification/src/macos.rs index 1dfba50a6..e10eb04c9 100644 --- a/wezterm-toast-notification/src/macos.rs +++ b/wezterm-toast-notification/src/macos.rs @@ -1,4 +1,5 @@ #![cfg(target_os = "macos")] + use crate::ToastNotification; use block2::{Block, RcBlock}; use objc2::rc::Retained; diff --git a/window/src/os/macos/keycodes.rs b/window/src/os/macos/keycodes.rs index 33b66b50b..731e158bf 100644 --- a/window/src/os/macos/keycodes.rs +++ b/window/src/os/macos/keycodes.rs @@ -1,5 +1,6 @@ #![allow(non_upper_case_globals)] #![allow(dead_code)] + use std::collections::HashMap; use wezterm_input_types::PhysKeyCode; diff --git a/window/src/os/macos/mod.rs b/window/src/os/macos/mod.rs index 3df046cdf..284b27ab5 100644 --- a/window/src/os/macos/mod.rs +++ b/window/src/os/macos/mod.rs @@ -1,4 +1,5 @@ #![allow(unexpected_cfgs)] // + use cocoa::base::{id, nil}; use cocoa::foundation::NSString; use objc::rc::StrongPtr; diff --git a/window/src/os/x11/mod.rs b/window/src/os/x11/mod.rs index 862b9cadf..f65c6b362 100644 --- a/window/src/os/x11/mod.rs +++ b/window/src/os/x11/mod.rs @@ -1,4 +1,5 @@ #![cfg(all(unix, not(target_os = "macos")))] + pub mod connection; pub mod cursor; pub mod keyboard; diff --git a/window/src/os/x11/xcb_util.rs b/window/src/os/x11/xcb_util.rs index a91493203..6fa05aecb 100644 --- a/window/src/os/x11/xcb_util.rs +++ b/window/src/os/x11/xcb_util.rs @@ -1,4 +1,5 @@ #![allow(non_camel_case_types)] + use libc::c_void; use xcb::ffi::*; diff --git a/window/src/os/xdg_desktop_portal.rs b/window/src/os/xdg_desktop_portal.rs index 0709efec5..f348eddcf 100644 --- a/window/src/os/xdg_desktop_portal.rs +++ b/window/src/os/xdg_desktop_portal.rs @@ -1,7 +1,7 @@ -#![cfg(all(unix, not(target_os = "macos")))] - //! +#![cfg(all(unix, not(target_os = "macos")))] + use crate::{Appearance, Connection, ConnectionOps}; use anyhow::Context; use futures_lite::future::FutureExt;