mirror of
https://github.com/ClementTsang/bottom.git
synced 2026-09-26 12:35:39 +00:00
refactor: run nightly format on code (#1951)
This commit is contained in:
@@ -8,7 +8,11 @@ max_width = 100
|
|||||||
style_edition = "2024"
|
style_edition = "2024"
|
||||||
|
|
||||||
# Unstable options, disabled by default.
|
# Unstable options, disabled by default.
|
||||||
|
|
||||||
|
# I usually re-enable these periodically and run cargo +nightly fmt.
|
||||||
# imports_granularity = "Crate"
|
# imports_granularity = "Crate"
|
||||||
# group_imports = "StdExternalCrate"
|
# group_imports = "StdExternalCrate"
|
||||||
|
|
||||||
|
# These sometimes break things, be careful re-enabling them.
|
||||||
# wrap_comments = true
|
# wrap_comments = true
|
||||||
# format_code_in_doc_comments = true
|
# format_code_in_doc_comments = true
|
||||||
|
|||||||
@@ -10,8 +10,10 @@ use tui::{
|
|||||||
widgets::{BorderType, GraphType},
|
widgets::{BorderType, GraphType},
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::canvas::components::time_graph::*;
|
use crate::{
|
||||||
use crate::{app::data::Values, canvas::drawing_utils::widget_block};
|
app::data::Values,
|
||||||
|
canvas::{components::time_graph::*, drawing_utils::widget_block},
|
||||||
|
};
|
||||||
|
|
||||||
/// Represents the data required by the [`TimeGraph`].
|
/// 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
|
//! See <https://github.com/ClementTsang/bottom/pull/918> and <https://github.com/ClementTsang/bottom/pull/937> for the
|
||||||
//! original motivation.
|
//! original motivation.
|
||||||
|
|
||||||
use super::grid::{CharGrid, Grid, HalfBlockGrid, PatternGrid};
|
use ratatui_core::symbols::{
|
||||||
use ratatui_core::symbols::braille::BRAILLE;
|
braille::BRAILLE,
|
||||||
use ratatui_core::symbols::pixel::{OCTANTS, QUADRANTS, SEXTANTS};
|
pixel::{OCTANTS, QUADRANTS, SEXTANTS},
|
||||||
use tui::prelude::BlockExt;
|
};
|
||||||
use tui::{
|
use tui::{
|
||||||
buffer::Buffer,
|
buffer::Buffer,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
|
prelude::BlockExt,
|
||||||
style::{Color, Style},
|
style::{Color, Style},
|
||||||
symbols::Marker,
|
symbols::Marker,
|
||||||
text::Line,
|
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.
|
/// Interface for all shapes that may be drawn on a Canvas widget.
|
||||||
pub trait Shape {
|
pub trait Shape {
|
||||||
fn draw(&self, painter: &mut Painter<'_, '_>);
|
fn draw(&self, painter: &mut Painter<'_, '_>);
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
//! Shared process data harvesting code from macOS and FreeBSD via sysinfo.
|
//! 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 std::{io, time::Duration};
|
||||||
|
|
||||||
|
use cfg_if::cfg_if;
|
||||||
use itertools::Itertools;
|
use itertools::Itertools;
|
||||||
use nohash::IntMap;
|
use nohash::IntMap;
|
||||||
use sysinfo::{ProcessStatus, System};
|
use sysinfo::{ProcessStatus, System};
|
||||||
|
|
||||||
use super::{ProcessHarvest, process_status_str};
|
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};
|
use crate::collection::{Pid, error::CollectionResult, processes::UserTable};
|
||||||
|
|
||||||
fn get_nice(pid: Pid) -> i32 {
|
fn get_nice(pid: Pid) -> i32 {
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
//! Process data collection for Windows. Uses sysinfo.
|
//! Process data collection for Windows. Uses sysinfo.
|
||||||
|
|
||||||
use super::{ProcessHarvest, process_status_str};
|
|
||||||
use crate::collection::{DataCollector, error::CollectionResult};
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use anyhow::bail;
|
use anyhow::bail;
|
||||||
@@ -11,6 +9,9 @@ use windows::Win32::{
|
|||||||
System::Threading::{GetPriorityClass, OpenProcess, PROCESS_QUERY_LIMITED_INFORMATION},
|
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)
|
/// 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
|
/// for more information on the core Windows API being called and the meaning of the priorities, as well as the access
|
||||||
/// rights needed.
|
/// rights needed.
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ use query::{ProcessQuery, parse_query};
|
|||||||
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
|
use rustc_hash::{FxHashMap as HashMap, FxHashSet as HashSet};
|
||||||
use sort_table::SortTableColumn;
|
use sort_table::SortTableColumn;
|
||||||
|
|
||||||
use crate::widgets::query::QueryOptions;
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app::{
|
app::{
|
||||||
AppConfigFields, AppSearchState,
|
AppConfigFields, AppSearchState,
|
||||||
@@ -26,6 +25,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
collection::processes::{Pid, ProcessHarvest},
|
collection::processes::{Pid, ProcessHarvest},
|
||||||
options::config::style::Styles,
|
options::config::style::Styles,
|
||||||
|
widgets::query::QueryOptions,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// ProcessSearchState only deals with process' search's current settings and
|
/// ProcessSearchState only deals with process' search's current settings and
|
||||||
|
|||||||
Reference in New Issue
Block a user