diff --git a/rustfmt.toml b/rustfmt.toml index 8308ec60..95736c2d 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -8,7 +8,11 @@ max_width = 100 style_edition = "2024" # Unstable options, disabled by default. + +# I usually re-enable these periodically and run cargo +nightly fmt. # imports_granularity = "Crate" # group_imports = "StdExternalCrate" + +# These sometimes break things, be careful re-enabling them. # wrap_comments = true # format_code_in_doc_comments = true diff --git a/src/canvas/components/time_graph/base.rs b/src/canvas/components/time_graph/base.rs index b13f71b6..a599c98b 100644 --- a/src/canvas/components/time_graph/base.rs +++ b/src/canvas/components/time_graph/base.rs @@ -10,8 +10,10 @@ use tui::{ widgets::{BorderType, GraphType}, }; -use crate::canvas::components::time_graph::*; -use crate::{app::data::Values, canvas::drawing_utils::widget_block}; +use crate::{ + app::data::Values, + canvas::{components::time_graph::*, drawing_utils::widget_block}, +}; /// Represents the data required by the [`TimeGraph`]. /// diff --git a/src/canvas/components/time_graph/vendored/canvas.rs b/src/canvas/components/time_graph/vendored/canvas.rs index 39213923..7f3c64df 100644 --- a/src/canvas/components/time_graph/vendored/canvas.rs +++ b/src/canvas/components/time_graph/vendored/canvas.rs @@ -12,13 +12,14 @@ //! See and for the //! original motivation. -use super::grid::{CharGrid, Grid, HalfBlockGrid, PatternGrid}; -use ratatui_core::symbols::braille::BRAILLE; -use ratatui_core::symbols::pixel::{OCTANTS, QUADRANTS, SEXTANTS}; -use tui::prelude::BlockExt; +use ratatui_core::symbols::{ + braille::BRAILLE, + pixel::{OCTANTS, QUADRANTS, SEXTANTS}, +}; use tui::{ buffer::Buffer, layout::Rect, + prelude::BlockExt, style::{Color, Style}, symbols::Marker, text::Line, @@ -28,6 +29,8 @@ use tui::{ }, }; +use super::grid::{CharGrid, Grid, HalfBlockGrid, PatternGrid}; + /// Interface for all shapes that may be drawn on a Canvas widget. pub trait Shape { fn draw(&self, painter: &mut Painter<'_, '_>); diff --git a/src/collection/processes/unix/process_ext.rs b/src/collection/processes/unix/process_ext.rs index a3510ad1..78e577ea 100644 --- a/src/collection/processes/unix/process_ext.rs +++ b/src/collection/processes/unix/process_ext.rs @@ -1,16 +1,15 @@ //! Shared process data harvesting code from macOS and FreeBSD via sysinfo. -#[cfg(target_os = "macos")] -use crate::collection::processes::macos::sysctl_bindings; - -use cfg_if::cfg_if; use std::{io, time::Duration}; +use cfg_if::cfg_if; use itertools::Itertools; use nohash::IntMap; use sysinfo::{ProcessStatus, System}; use super::{ProcessHarvest, process_status_str}; +#[cfg(target_os = "macos")] +use crate::collection::processes::macos::sysctl_bindings; use crate::collection::{Pid, error::CollectionResult, processes::UserTable}; fn get_nice(pid: Pid) -> i32 { diff --git a/src/collection/processes/windows.rs b/src/collection/processes/windows.rs index 09d3d60a..47d33d85 100644 --- a/src/collection/processes/windows.rs +++ b/src/collection/processes/windows.rs @@ -1,7 +1,5 @@ //! Process data collection for Windows. Uses sysinfo. -use super::{ProcessHarvest, process_status_str}; -use crate::collection::{DataCollector, error::CollectionResult}; use std::time::Duration; use anyhow::bail; @@ -11,6 +9,9 @@ use windows::Win32::{ System::Threading::{GetPriorityClass, OpenProcess, PROCESS_QUERY_LIMITED_INFORMATION}, }; +use super::{ProcessHarvest, process_status_str}; +use crate::collection::{DataCollector, error::CollectionResult}; + /// See [here](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getpriorityclass) /// for more information on the core Windows API being called and the meaning of the priorities, as well as the access /// rights needed. diff --git a/src/widgets/process_table.rs b/src/widgets/process_table.rs index 3919e1d8..8097e333 100644 --- a/src/widgets/process_table.rs +++ b/src/widgets/process_table.rs @@ -14,7 +14,6 @@ use query::{ProcessQuery, parse_query}; use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet}; use sort_table::SortTableColumn; -use crate::widgets::query::QueryOptions; use crate::{ app::{ AppConfigFields, AppSearchState, @@ -26,6 +25,7 @@ use crate::{ }, collection::processes::{Pid, ProcessHarvest}, options::config::style::Styles, + widgets::query::QueryOptions, }; /// ProcessSearchState only deals with process' search's current settings and