Browse Source

Fix typos

Found via `typos --format brief`
pull/55/head
Kian-Meng Ang 2 years ago
parent
commit
6858c276aa
  1. 2
      README.md
  2. 6
      src/app.rs
  3. 2
      src/lib.rs
  4. 12
      src/plot/matchbar.rs
  5. 2
      src/plot/mod.rs
  6. 2
      src/plot/timehist.rs

2
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);

6
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),

2
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);

12
src/plot/matchbar.rs

@ -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,
}
}
}
@ -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}");

2
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 {

2
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 {

Loading…
Cancel
Save