Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
Found via `typos --format brief`
  • Loading branch information
kianmeng committed Oct 22, 2023
1 parent 2270715 commit 6858c27
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 6 additions & 6 deletions src/plot/matchbar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ impl MatchBarRow {
pub struct MatchBar {
pub vec: Vec<MatchBarRow>,
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<MatchBarRow>) -> 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,
}
}
}
Expand All @@ -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)
)?;
Expand All @@ -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}");
Expand Down
2 changes: 1 addition & 1 deletion src/plot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/plot/timehist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 6858c27

Please sign in to comment.