Fix typos and use more idiomatic assertions (#7755)

I have changed `assert!(a == b)` calls to `assert_eq!(a, b)`, which give
better error messages. Similarly for `assert!(a != b)` and
`assert_ne!(a, b)`. Basically all instances were comparing primitives
(string slices or integers), so there is no loss of generality from
special-case macros,

I have also fixed a number of typos in comments, variable names, and a
few user-facing messages.
This commit is contained in:
Anton
2023-01-15 05:03:32 +03:00
committed by GitHub
parent b0b0482d71
commit 7221eb7f39
32 changed files with 143 additions and 143 deletions

View File

@ -387,13 +387,13 @@ where
}
fn maybe_truncate_columns(data: &mut Data, theme: &TableTheme, termwidth: usize) -> bool {
const TERMWIDTH_TRESHHOLD: usize = 120;
const TERMWIDTH_THRESHOLD: usize = 120;
if data.count_columns() == 0 {
return true;
}
let truncate = if termwidth > TERMWIDTH_TRESHHOLD {
let truncate = if termwidth > TERMWIDTH_THRESHOLD {
truncate_columns_by_columns
} else {
truncate_columns_by_content

View File

@ -7,7 +7,7 @@ pub fn string_width(text: &str) -> usize {
pub fn string_wrap(text: &str, width: usize, keep_words: bool) -> String {
// todo: change me...
//
// well... it's not effitient to build a table to wrap a string,
// well... it's not efficient to build a table to wrap a string,
// but ... it's better than a copy paste (is it?)
if text.is_empty() {