Skip to content

Commit

Permalink
ran cargo fmt locally
Browse files Browse the repository at this point in the history
  • Loading branch information
GrecuAlexandru committed Jan 8, 2024
1 parent 39286a4 commit bef4292
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,25 +277,25 @@ fn main() -> Result<()> {

app.converted_data.mem_labels = convert_mem_label(
&app.data_collection.memory_harvest,
app.app_config_fields.memory_use_mega_prefix
app.app_config_fields.memory_use_mega_prefix,
);
app.converted_data.swap_labels = convert_mem_label(
&app.data_collection.swap_harvest,
app.app_config_fields.memory_use_mega_prefix
app.app_config_fields.memory_use_mega_prefix,
);
#[cfg(not(target_os = "windows"))]
{
app.converted_data.cache_labels = convert_mem_label(
&app.data_collection.cache_harvest,
app.app_config_fields.memory_use_mega_prefix
app.app_config_fields.memory_use_mega_prefix,
);
}

#[cfg(feature = "zfs")]
{
let arc_labels = convert_mem_label(
&app.data_collection.arc_harvest,
app.app_config_fields.memory_use_mega_prefix
app.app_config_fields.memory_use_mega_prefix,
);
app.converted_data.arc_labels = arc_labels;
}
Expand Down
6 changes: 3 additions & 3 deletions src/data_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub fn convert_swap_data_points(current_data: &DataCollection) -> Vec<Point> {
/// The expected usage is to divide out the given value with the returned denominator in order to be able to use it
/// with the returned binary unit (e.g. divide 3000 bytes by 1024 to have a value in KiB).
fn get_mem_binary_unit_and_denominator(
bytes: u64, memory_use_mega_prefix: bool
bytes: u64, memory_use_mega_prefix: bool,
) -> (&'static str, f64) {
if memory_use_mega_prefix {
if bytes < KIBI_LIMIT {
Expand Down Expand Up @@ -298,11 +298,11 @@ fn get_mem_binary_unit_and_denominator(

/// Returns the unit type and denominator for given total amount of memory in kibibytes.
pub fn convert_mem_label(
harvest: &MemHarvest, memory_use_mega_prefix: bool
harvest: &MemHarvest, memory_use_mega_prefix: bool,
) -> Option<(String, String)> {
if harvest.total_bytes > 0 {
Some((format!("{:3.0}%", harvest.use_percent.unwrap_or(0.0)), {
let (unit, denominator) =
let (unit, denominator) =
get_mem_binary_unit_and_denominator(harvest.total_bytes, memory_use_mega_prefix);

format!(
Expand Down

0 comments on commit bef4292

Please sign in to comment.