refactor: run nightly format on code (#1951)

This commit is contained in:
Clement Tsang
2026-01-05 03:59:14 -05:00
committed by GitHub
parent b3445b3044
commit 7682f9d6b3
6 changed files with 22 additions and 13 deletions
+4
View File
@@ -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
+4 -2
View File
@@ -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`].
///
@@ -12,13 +12,14 @@
//! See <https://github.com/ClementTsang/bottom/pull/918> and <https://github.com/ClementTsang/bottom/pull/937> 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<'_, '_>);
+3 -4
View File
@@ -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 {
+3 -2
View File
@@ -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.
+1 -1
View File
@@ -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