Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade to rust 2021 edition #18

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ license = "MIT OR Apache-2.0"
name = "hash32"
repository = "https://github.com/japaric/hash32"
version = "0.3.1"
edition = "2021"
rust-version = "1.56"

[dependencies.byteorder]
default-features = false
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,7 @@ at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the
work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
additional terms or conditions.

## Minimum Supported Rust Version (MSRV)
This crate is guaranteed to compile on stable Rust 1.56 and up. It *might*
compile with older versions but that may change in any new patch release.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ use core::fmt;
use core::hash::BuildHasher;
use core::marker::PhantomData;

pub use fnv::Hasher as FnvHasher;
pub use murmur3::Hasher as Murmur3Hasher;
pub use crate::fnv::Hasher as FnvHasher;
pub use crate::murmur3::Hasher as Murmur3Hasher;

mod fnv;
mod murmur3;
Expand Down
2 changes: 1 addition & 1 deletion src/murmur3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl core::hash::Hasher for Hasher {
let mid = 4 - index;
let head = unsafe { slice::from_raw_parts(bytes.as_ptr(), mid) };
let body = unsafe {
slice::from_raw_parts(bytes.as_ptr().offset(mid as isize), len - mid)
slice::from_raw_parts(bytes.as_ptr().add(mid), len - mid)
};

// NOTE(unsafe) avoid calling `memcpy` on a 0-3 byte copy
Expand Down