Skip to content

Commit

Permalink
release: 0.7.3
Browse files Browse the repository at this point in the history
  • Loading branch information
joshstoik1 committed Sep 5, 2024
2 parents fc0f32b + f702432 commit df894d4
Show file tree
Hide file tree
Showing 21 changed files with 185 additions and 132 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@



## [0.7.3](https://github.com/Blobfolio/dactyl/releases/tag/v0.7.3) - 2024-09-05

### Changed

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



## [0.7.2](https://github.com/Blobfolio/dactyl/releases/tag/v0.7.2) - 2024-07-25

### 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: dactyl
Version: 0.7.2
Generated: 2024-07-25 17:02:20 UTC
Version: 0.7.3
Generated: 2024-09-05 19:01:43 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 = "dactyl"
version = "0.7.2"
version = "0.7.3"
authors = ["Blobfolio, LLC. <[email protected]>"]
edition = "2021"
rust-version = "1.70"
Expand Down Expand Up @@ -28,7 +28,7 @@ man-dir = "./"
credits-dir = "./"

[dev-dependencies]
brunch = "0.5.*"
brunch = "0.6.*"
fastrand = "2"
num-format = "0.4.*"

Expand Down
8 changes: 4 additions & 4 deletions benches/fn_nice_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ benches!(
.run(|| NiceFloat::from(f64::NAN)),

Bench::new("dactyl::NicePercent::from(12345.6789)")
.run(|| NiceFloat::from(12_345.6789_f64)),
.run(|| NiceFloat::from(12_345.678_9_f64)),

Bench::spacer(),

Bench::new("dactyl::NicePercent::from(12345.6789).as_bytes()")
.run_seeded(NiceFloat::from(12_345.6789_f64), |n| n.as_bytes().len()),
.run_seeded(NiceFloat::from(12_345.678_9_f64), |n| n.as_bytes().len()),

Bench::new("dactyl::NicePercent::from(12345.6789).compact_bytes()")
.run_seeded(NiceFloat::from(12_345.6789_f64), |n| n.compact_bytes().len()),
.run_seeded(NiceFloat::from(12_345.678_9_f64), |n| n.compact_bytes().len()),

Bench::new("dactyl::NicePercent::from(12345.6789).precise_bytes(3)")
.run_seeded(NiceFloat::from(12_345.6789_f64), |n| n.precise_bytes(3).len()),
.run_seeded(NiceFloat::from(12_345.678_9_f64), |n| n.precise_bytes(3).len()),
);
4 changes: 2 additions & 2 deletions benches/fn_nohash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ fn t_nohash() -> HashSet<u16, NoHash> { (u16::MIN..=u16::MAX).collect() }

benches!(
Bench::new("(u16::MIN..=u16::MAX).collect::<HashSet<u16>>()")
.run(|| t_hash()),
.run(t_hash),

Bench::new("(u16::MIN..=u16::MAX).collect::<HashSet<u16, NoHash>>()")
.run(|| t_nohash()),
.run(t_nohash),
);
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ enum AnyNum {
macro_rules! into_any {
($($from:ty),+) => ($(
impl From<$from> for AnyNum {
#[allow(unused_comparisons)]
#[allow(unused_comparisons)] // Needed for signed types.
fn from(src: $from) -> Self {
if src < 0 { Self::Signed(src as i128) }
else { Self::Unsigned(src as u128) }
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
19 changes: 11 additions & 8 deletions src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,10 @@ pub type NoHash = BuildHasherDefault<NoHasher>;
/// See [`NoHash`] for usage details.
pub struct NoHasher(u64);

/// # Helper: Write Method(s) for Unsigned Ints.
macro_rules! write_unsigned {
($($fn:ident, $ty:ty),+ $(,)?) => ($(
#[allow(clippy::cast_lossless)]
#[allow(clippy::cast_lossless)] // "False positive."
#[inline]
#[doc = concat!("# Write `", stringify!($ty), "`")]
fn $fn(&mut self, val: $ty) {
Expand All @@ -132,9 +133,11 @@ macro_rules! write_unsigned {
)+);
}

/// # Helper: Write Method(s) for Signed Ints.
macro_rules! write_signed {
($($fn:ident, $ty1:ty, $ty2:ty),+ $(,)?) => ($(
#[allow(clippy::cast_lossless, clippy::cast_sign_loss)]
#[allow(clippy::cast_lossless)] // False positive.
#[allow(clippy::cast_sign_loss)] // False positive.
#[inline]
#[doc = concat!("# Write `", stringify!($ty1), "`")]
fn $fn(&mut self, val: $ty1) {
Expand Down Expand Up @@ -192,38 +195,38 @@ mod tests {
// to, i.e. as the underlying type.
let mut set: HashSet<NonZeroU8, NoHash> = (1..=u8::MAX).filter_map(NonZeroU8::new).collect();
assert_eq!(set.len(), 255);
assert_eq!(set.insert(NonZeroU8::new(1).unwrap()), false); // Should already be there.
assert!(!set.insert(NonZeroU8::new(1).unwrap())); // Should already be there.
}

#[test]
fn t_wrapping() {
// This just verifies that Wrapping hashes its inner value directly.
let mut set: HashSet<Wrapping<u8>, NoHash> = (0..=u8::MAX).map(Wrapping).collect();
assert_eq!(set.len(), 256);
assert_eq!(set.insert(Wrapping(0)), false); // Should already be there.
assert!(!set.insert(Wrapping(0))); // Should already be there.
}

#[test]
fn t_u8() {
let mut set: HashSet<u8, NoHash> = (0..=u8::MAX).collect();
assert_eq!(set.len(), 256);
assert_eq!(set.insert(0), false); // Should already be there.
assert!(!set.insert(0)); // Should already be there.

let mut set: HashSet<i8, NoHash> = (i8::MIN..=i8::MAX).collect();
assert_eq!(set.len(), 256);
assert_eq!(set.insert(0), false); // Should already be there.
assert!(!set.insert(0)); // Should already be there.
}

#[cfg(not(miri))]
#[test]
fn t_u16() {
let mut set: HashSet<u16, NoHash> = (0..=u16::MAX).collect();
assert_eq!(set.len(), 65_536);
assert_eq!(set.insert(0), false); // Should already be there.
assert!(!set.insert(0)); // Should already be there.

let mut set: HashSet<i16, NoHash> = (i16::MIN..=i16::MAX).collect();
assert_eq!(set.len(), 65_536);
assert_eq!(set.insert(0), false); // Should already be there.
assert!(!set.insert(0)); // Should already be there.
}

macro_rules! sanity_check_signed {
Expand Down
47 changes: 35 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,34 +44,56 @@ But the niceness doesn't stop there. Dactyl provides several other structs, meth
*/

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

#![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,
clippy::redundant_pub_crate
)] // This is fine.
#![allow(clippy::module_name_repetitions)] // Repetition is preferred.
#![allow(clippy::redundant_pub_crate)] // Unresolvable.



Expand Down Expand Up @@ -125,7 +147,8 @@ const DOUBLE: [[u8; 2]; 100] = [
pub(crate) const fn double(idx: usize) -> [u8; 2] { DOUBLE[idx] }

#[inline]
#[allow(clippy::cast_possible_truncation, clippy::integer_division)]
#[allow(clippy::cast_possible_truncation)] // False positive.
#[allow(clippy::integer_division)] // We want this.
/// # Triple Digits.
///
/// Return both digits, ASCII-fied.
Expand Down
Loading

0 comments on commit df894d4

Please sign in to comment.