Skip to content

Commit

Permalink
release: 0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Sep 5, 2024
2 parents 82e7f84 + 18ed709 commit 8a6a1bf
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 24 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Changelog



## [0.3.1](https://github.com/Blobfolio/trimothy/releases/tag/v0.3.1) - 2024-09-05

### Changed

* Miscellaneous code cleanup and lints
* Bump `brunch` to `0.6`



## [0.3.0](https://github.com/Blobfolio/trimothy/releases/tag/v0.3.0) - 2024-07-29

### Changed
Expand Down
4 changes: 2 additions & 2 deletions CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project Dependencies
Package: trimothy
Version: 0.3.0
Generated: 2024-07-29 19:21:37 UTC
Version: 0.3.1
Generated: 2024-09-05 19:10:32 UTC

This package has no dependencies.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "trimothy"
version = "0.3.0"
version = "0.3.1"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.80"
Expand All @@ -25,7 +25,7 @@ man-dir = "./"
credits-dir = "./"

[dev-dependencies]
brunch = "0.5.*"
brunch = "0.6.*"

[[bench]]
name = "fn_trim_slice"
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ bench BENCH="":
# Clippy.
@clippy:
clear
cargo clippy --target-dir "{{ cargo_dir }}"
cargo clippy \
--release \
--target-dir "{{ cargo_dir }}"
Expand Down
8 changes: 8 additions & 0 deletions src/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,16 @@ impl<'a> NormalizeWhitespace<char, Chars<'a>> for &'a str {
/// This is the actual iterator returned by a
/// `NormalizeWhitespace::normalized_whitespace` implementation.
pub struct NormalizeWhiteSpaceIter<T: Copy + Sized, I: Iterator<Item=T>> {
/// # Iterator.
iter: I,

/// # Normalize Control Characters?
normalize_control: bool,

/// # Next Buffer.
///
/// This holds extra values from a previous pass, ensuring nothing gets
/// missed due to peeking, etc.
next: Option<T>,
}

Expand Down
42 changes: 34 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,28 +64,54 @@ This trait is implemented for `&[u8]`, `&str`, and `Iterator`s with `u8`/`char`

#![forbid(unsafe_code)]

#![deny(
// TODO: clippy::allow_attributes_without_reason,
clippy::correctness,
unreachable_pub,
)]

#![warn(
clippy::filetype_is_file,
clippy::integer_division,
clippy::needless_borrow,
clippy::complexity,
clippy::nursery,
clippy::pedantic,
clippy::perf,
clippy::suboptimal_flops,
clippy::style,
// TODO: clippy::allow_attributes,
clippy::clone_on_ref_ptr,
clippy::create_dir,
clippy::filetype_is_file,
clippy::format_push_string,
clippy::get_unwrap,
clippy::impl_trait_in_params,
clippy::lossy_float_literal,
clippy::missing_assert_message,
clippy::missing_docs_in_private_items,
clippy::needless_raw_strings,
clippy::panic_in_result_fn,
clippy::pub_without_shorthand,
clippy::rest_pat_in_fully_bound_structs,
clippy::semicolon_inside_block,
clippy::str_to_string,
clippy::string_to_string,
clippy::todo,
clippy::undocumented_unsafe_blocks,
clippy::unneeded_field_pattern,
clippy::unseparated_literal_suffix,
clippy::unwrap_in_result,
macro_use_extern_crate,
missing_copy_implementations,
missing_debug_implementations,
missing_docs,
non_ascii_idents,
trivial_casts,
trivial_numeric_casts,
unreachable_pub,
unused_crate_dependencies,
unused_extern_crates,
unused_import_braces,
)]
#![allow(clippy::module_name_repetitions)]

#![allow(clippy::module_name_repetitions)] // Repetition is preferred.

#![no_std]

Expand All @@ -104,7 +130,7 @@ pub use trim_slice::TrimSliceMatches;



#[allow(clippy::trivially_copy_pass_by_ref)] // It's the signature iterator wants.
#[allow(clippy::trivially_copy_pass_by_ref)] // This signature is required.
#[inline]
/// # Not Whitespace.
///
Expand Down
6 changes: 3 additions & 3 deletions src/trim_mut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -526,15 +526,15 @@ mod tests {
v2.trim_start_mut();
assert_eq!(v2, v.trim_start());

v2 = v.to_owned();
v.clone_into(&mut v2);
v2.trim_end_mut();
assert_eq!(v2, v.trim_end());

v2 = v.to_owned();
v.clone_into(&mut v2);
v2.trim_mut();
assert_eq!(v2, v.trim());

v2 = v.to_owned();
v.clone_into(&mut v2);
v2.trim_matches_mut(|c| c == '\t');
assert_eq!(v2, v.trim_matches(|c| c == '\t'));
}
Expand Down
19 changes: 10 additions & 9 deletions src/trim_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ pub trait TrimSliceMatches {
}


/// # Helper: Trim Slice Matches.
macro_rules! trim_slice {
($($ty:ty),+ $(,)?) => ($(
impl TrimSliceMatches for $ty {
Expand Down Expand Up @@ -144,7 +145,7 @@ mod tests {
("\n hello world! \t", "hello world!"),
];

for (raw, expected) in tests.iter() {
for (raw, expected) in &tests {
let a = raw.as_bytes();
let b = expected.as_bytes();
assert_eq!(a.trim_ascii(), b);
Expand All @@ -160,8 +161,8 @@ mod tests {
assert_eq!(T_EMPTY.to_vec().trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(Box::<[u8]>::from(T_EMPTY).trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);

assert_eq!(" ".as_bytes().trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(" ".as_bytes().to_vec().trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(b" ".trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(b" ".to_vec().trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(Box::<[u8]>::from(" ".as_bytes()).trim_matches(|b| b.is_ascii_whitespace()), T_EMPTY);

assert_eq!(T_HELLO_E.trim_matches(|b| b'h' == b), b"ello\t");
Expand All @@ -184,7 +185,7 @@ mod tests {
("\n hello world! \t", "hello world! \t"),
];

for (raw, expected) in tests.iter() {
for (raw, expected) in &tests {
let a = raw.as_bytes();
let b = expected.as_bytes();
assert_eq!(a.trim_ascii_start(), b);
Expand All @@ -200,8 +201,8 @@ mod tests {
assert_eq!(T_EMPTY.to_vec().trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(Box::<[u8]>::from(T_EMPTY).trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);

assert_eq!(" ".as_bytes().trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(" ".as_bytes().to_vec().trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(b" ".trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(b" ".to_vec().trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(Box::<[u8]>::from(" ".as_bytes()).trim_start_matches(|b| b.is_ascii_whitespace()), T_EMPTY);

assert_eq!(T_HELLO_E.trim_start_matches(|b| b'h' == b), b"ello\t");
Expand All @@ -220,7 +221,7 @@ mod tests {
("\n hello world! \t", "\n hello world!"),
];

for (raw, expected) in tests.iter() {
for (raw, expected) in &tests {
let a = raw.as_bytes();
let b = expected.as_bytes();
assert_eq!(a.trim_ascii_end(), b);
Expand All @@ -236,8 +237,8 @@ mod tests {
assert_eq!(T_EMPTY.to_vec().trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(Box::<[u8]>::from(T_EMPTY).trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);

assert_eq!(" ".as_bytes().trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(" ".as_bytes().to_vec().trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(b" ".trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(b" ".to_vec().trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);
assert_eq!(Box::<[u8]>::from(" ".as_bytes()).trim_end_matches(|b| b.is_ascii_whitespace()), T_EMPTY);

assert_eq!(T_HELLO_E.trim_matches(|b| b'\t' == b), T_HELLO);
Expand Down

0 comments on commit 8a6a1bf

Please sign in to comment.