From 6858c276aa420b15affb9cdf27e6e16973f0f7a7 Mon Sep 17 00:00:00 2001 From: Kian-Meng Ang Date: Sun, 22 Oct 2023 15:06:27 +0800 Subject: [PATCH] Fix typos Found via `typos --format brief` --- README.md | 2 +- src/app.rs | 6 +++--- src/lib.rs | 2 +- src/plot/matchbar.rs | 12 ++++++------ src/plot/mod.rs | 2 +- src/plot/timehist.rs | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index b32bc59..53a1790 100644 --- a/README.md +++ b/README.md @@ -197,7 +197,7 @@ use lowcharts::plot; let vec = &[-1.0, -1.1, 2.0, 2.0, 2.1, -0.9, 11.0, 11.2, 1.9, 1.99]; // Plot a histogram of the above vector, with 4 buckets and a precision -// choosen by library +// chosen by library let options = plot::HistogramOptions { intervals: 4, ..Default::default() }; let histogram = plot::Histogram::new(vec, options); print!("{}", histogram); diff --git a/src/app.rs b/src/app.rs index 2df2bf1..db057ec 100644 --- a/src/app.rs +++ b/src/app.rs @@ -138,10 +138,10 @@ pub fn get_app() -> Command<'static> { let mut matches = Command::new("matches") .version(clap::crate_version!()) .allow_missing_positional(true) - .about("Plot barchar with counts of occurences of matches params"); + .about("Plot barchar with counts of occurrences of matches params"); matches = add_input_as_option(add_width(matches)).arg( Arg::new("match") - .help("Count maches for those strings") + .help("Count matches for those strings") .required(true) .takes_value(true) .multiple_occurrences(true), @@ -181,7 +181,7 @@ pub fn get_app() -> Command<'static> { ); splittimehist = add_input_as_option(add_width(add_intervals(splittimehist))).arg( Arg::new("match") - .help("Count maches for those strings") + .help("Count matches for those strings") .required(true) .takes_value(true) .multiple_occurrences(true), diff --git a/src/lib.rs b/src/lib.rs index 9b31471..e5c5c09 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -10,7 +10,7 @@ //! //! let vec = &[-1.0, -1.1, 2.0, 2.0, 2.1, -0.9, 11.0, 11.2, 1.9, 1.99]; //! // Plot a histogram of the above vector, with 4 buckets and a precision -//! // choosen by library +//! // chosen by library //! let options = plot::HistogramOptions { intervals: 4, ..Default::default() }; //! let histogram = plot::Histogram::new(vec, options); //! print!("{}", histogram); diff --git a/src/plot/matchbar.rs b/src/plot/matchbar.rs index dec8ef8..c6639d3 100644 --- a/src/plot/matchbar.rs +++ b/src/plot/matchbar.rs @@ -33,22 +33,22 @@ impl MatchBarRow { pub struct MatchBar { pub vec: Vec, top_values: usize, - top_lenght: usize, + top_length: usize, } impl MatchBar { /// Creates a Histogram from a vector of `MatchBarRow` elements. pub fn new(vec: Vec) -> Self { - let mut top_lenght: usize = 0; + let mut top_length: usize = 0; let mut top_values: usize = 0; for row in &vec { - top_lenght = top_lenght.max(row.label.len()); + top_length = top_length.max(row.label.len()); top_values = top_values.max(row.count); } Self { vec, top_values, - top_lenght, + top_length, } } } @@ -71,7 +71,7 @@ impl fmt::Display for MatchBar { writeln!( f, "[{label}] [{count}] {bar}", - label = Blue.paint(format!("{:width$}", row.label, width = self.top_lenght)), + label = Blue.paint(format!("{:width$}", row.label, width = self.top_length)), count = horizontal_scale.get_count(row.count, width_count), bar = horizontal_scale.get_bar(row.count) )?; @@ -95,7 +95,7 @@ mod tests { let mut row1 = MatchBarRow::new("label2"); row1.inc_if_matches("label2"); let mb = MatchBar::new(vec![row0, row1, MatchBarRow::new("label333")]); - assert_eq!(mb.top_lenght, 8); + assert_eq!(mb.top_length, 8); assert_eq!(mb.top_values, 3); Paint::disable(); let display = format!("{mb}"); diff --git a/src/plot/mod.rs b/src/plot/mod.rs index 2c132ea..8637473 100644 --- a/src/plot/mod.rs +++ b/src/plot/mod.rs @@ -12,7 +12,7 @@ mod terms; mod timehist; mod xy; -/// Returns a datetime formating string with a resolution that makes sense for a +/// Returns a datetime formatting string with a resolution that makes sense for a /// given number of seconds fn date_fmt_string(seconds: i64) -> &'static str { match seconds { diff --git a/src/plot/timehist.rs b/src/plot/timehist.rs index ff38af6..5ab9994 100644 --- a/src/plot/timehist.rs +++ b/src/plot/timehist.rs @@ -85,7 +85,7 @@ impl TimeHistogram { } else { let x = (ts - self.min).num_microseconds().unwrap() as u64; if self.nanos == 0 { - // All timestamps are the same. We will have a degenrate plot + // All timestamps are the same. We will have a degenerate plot // (as opposed to failing hard). Some(0) } else {