Skip to content

Commit

Permalink
remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacholt100 committed Sep 19, 2024
1 parent e202f08 commit 52dcea2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This crate uses Rust's const generics to allow creation of integers of arbitrary

- **Zero dependencies by default**: `bnum` does not depend on any other crates by default. Support for crates such as [`rand`](https://docs.rs/rand/latest/rand/) and [`serde`](https://docs.rs/serde/latest/serde/) can be enabled with crate [features](#features).
- **`no-std` compatible**: `bnum` can be used in `no_std` environments, provided that the [`arbitrary`](#fuzzing) and [`quickcheck`](#quickcheck) features are not enabled.
- **Compile-time integer parsing**: the `from_str_radix` and `parse_str_radix` methods on `bnum` integers are `const`, which allows parsing of integers from string slices at compile time. Note that this is more powerful than compile-time parsing of integer literals. This is because it allows parsing of strings in all radices from `2` to `36` inclusive instead of just `2`, `8`, `10` and `16`. Additionally, the string to be parsed does not have to be a literal: it could, for example, be obtained via [`include_str!`](https://doc.rust-lang.org/core/macro.include_str.html), or [`env!`](https://doc.rust-lang.org/core/macro.env.html)`.
- **Compile-time integer parsing**: the `from_str_radix` and `parse_str_radix` methods on `bnum` integers are `const`, which allows parsing of integers from string slices at compile time. Note that this is more powerful than compile-time parsing of integer literals. This is because it allows parsing of strings in all radices from `2` to `36` inclusive instead of just `2`, `8`, `10` and `16`. Additionally, the string to be parsed does not have to be a literal: it could, for example, be obtained via [`include_str!`](https://doc.rust-lang.org/core/macro.include_str.html), or [`env!`](https://doc.rust-lang.org/core/macro.env.html).
- **`const` evaluation**: nearly all methods defined on `bnum` integers are `const`, which allows complex compile-time calculations.

## Installation
Expand Down
10 changes: 5 additions & 5 deletions src/buint/as_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub trait Mantissa {
fn add(self, rhs: Self) -> Self;
fn sub(self, rhs: Self) -> Self;
fn leading_zeros(self) -> ExpType;
fn bitand(self, rhs: Self) -> Self;
// fn bitand(self, rhs: Self) -> Self;
fn gt(&self, rhs: &Self) -> bool;
}

Expand Down Expand Up @@ -188,10 +188,10 @@ macro_rules! impl_mantissa_for_uint {
Self::leading_zeros(self) as ExpType
}

#[inline]
fn bitand(self, rhs: Self) -> Self {
self & rhs
}
// #[inline]
// fn bitand(self, rhs: Self) -> Self {
// self & rhs
// }

#[inline]
fn gt(&self, rhs: &Self) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions src/buint/endian.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ macro_rules! endian {
#[inline]
pub const fn from_be_bytes(bytes: [u8; N * digit::$Digit::BYTES as usize]) -> Self {
let mut out = Self::ZERO;
let arr_ptr = bytes.as_ptr();
// let arr_ptr = bytes.as_ptr();
let mut i = 0;
while i < N {
let mut digit_bytes = [0u8; digit::$Digit::BYTES as usize];
Expand All @@ -256,7 +256,7 @@ macro_rules! endian {
#[inline]
pub const fn from_le_bytes(bytes: [u8; N * digit::$Digit::BYTES as usize]) -> Self {
let mut out = Self::ZERO;
let arr_ptr = bytes.as_ptr();
// let arr_ptr = bytes.as_ptr();
let mut i = 0;
while i < N {
let mut digit_bytes = [0u8; digit::$Digit::BYTES as usize];
Expand Down
3 changes: 3 additions & 0 deletions src/cast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pub trait CastFrom<T> {
}

// #[cfg_attr(feature = "nightly", const_trait)]
#[cfg(test)]
pub(crate) trait CastTo<U> {
fn cast_to(self) -> U;
}
Expand Down Expand Up @@ -55,6 +56,7 @@ assert_eq!(b, f.as_());
macro_rules! as_trait {
() => {
// impl<T, U> const CastTo<U> for T
#[cfg(test)]
impl<T, U> CastTo<U> for T
where
// U: ~const CastFrom<T>,
Expand Down Expand Up @@ -93,6 +95,7 @@ macro_rules! as_trait {
#[cfg(not(feature = "nightly"))]
macro_rules! as_trait {
() => {
#[cfg(test)]
impl<T, U> CastTo<U> for T
where
U: CastFrom<T>,
Expand Down

0 comments on commit 52dcea2

Please sign in to comment.