Upgrating to 2018 edition

This commit is contained in:
Adam 2019-06-18 22:12:59 +02:00
parent 84e14d4f36
commit 711d057f6f
9 changed files with 18 additions and 19 deletions

View File

@ -9,6 +9,7 @@ license = "MIT/Apache-2.0"
repository = "https://github.com/rust-num/num-traits"
name = "num-traits"
version = "0.2.8"
edition = "2018"
readme = "README.md"
build = "build.rs"
exclude = ["/ci/*", "/.travis.yml", "/bors.toml"]

View File

@ -95,8 +95,8 @@ fn wrapping_bounded() {
macro_rules! test_wrapping_bounded {
($($t:ty)+) => {
$(
assert_eq!(Wrapping::<$t>::min_value().0, <$t>::min_value());
assert_eq!(Wrapping::<$t>::max_value().0, <$t>::max_value());
assert_eq!(<Wrapping<$t> as Bounded>::min_value().0, <$t>::min_value());
assert_eq!(<Wrapping<$t> as Bounded>::max_value().0, <$t>::max_value());
)+
};
}
@ -110,8 +110,8 @@ fn wrapping_bounded_i128() {
macro_rules! test_wrapping_bounded {
($($t:ty)+) => {
$(
assert_eq!(Wrapping::<$t>::min_value().0, <$t>::min_value());
assert_eq!(Wrapping::<$t>::max_value().0, <$t>::max_value());
assert_eq!(<Wrapping<$t> as Bounded>::min_value().0, <$t>::min_value());
assert_eq!(<Wrapping<$t> as Bounded>::max_value().0, <$t>::max_value());
)+
};
}

View File

@ -6,7 +6,7 @@ use core::{i128, u128};
use core::{i16, i32, i64, i8, isize};
use core::{u16, u32, u64, u8, usize};
use float::FloatCore;
use crate::float::FloatCore;
/// A generic trait for converting a value to a number.
pub trait ToPrimitive {

View File

@ -5,7 +5,7 @@ use core::ops::Neg;
use core::f32;
use core::f64;
use {Num, NumCast, ToPrimitive};
use crate::{Num, NumCast, ToPrimitive};
/// Generic trait for floating point numbers that works with `no_std`.
///
@ -1982,7 +1982,7 @@ mod tests {
#[test]
fn convert_deg_rad() {
use float::FloatCore;
use crate::float::FloatCore;
for &(deg, rad) in &DEG_RAD_PAIRS {
assert!((FloatCore::to_degrees(rad) - deg).abs() < 1e-6);
@ -1998,7 +1998,7 @@ mod tests {
#[test]
fn convert_deg_rad_std() {
for &(deg, rad) in &DEG_RAD_PAIRS {
use Float;
use crate::Float;
assert!((Float::to_degrees(rad) - deg).abs() < 1e-6);
assert!((Float::to_radians(deg) - rad).abs() < 1e-6);

View File

@ -1,9 +1,9 @@
use core::ops::{BitAnd, BitOr, BitXor, Not, Shl, Shr};
use bounds::Bounded;
use ops::checked::*;
use ops::saturating::Saturating;
use {Num, NumCast};
use crate::bounds::Bounded;
use crate::ops::checked::*;
use crate::ops::saturating::Saturating;
use crate::{Num, NumCast};
/// Generic trait for primitive integers.
///

View File

@ -16,9 +16,7 @@
#![doc(html_root_url = "https://docs.rs/num-traits/0.2")]
#![deny(unconditional_recursion)]
#![no_std]
#[cfg(feature = "std")]
extern crate std;
#![cfg_attr(not(feature = "std"), no_std)]
use core::fmt;
use core::num::Wrapping;

View File

@ -1,6 +1,6 @@
use core::num::Wrapping;
use core::ops::Mul;
use {CheckedMul, One};
use crate::{CheckedMul, One};
/// Binary operator for raising a value to a power.
pub trait Pow<RHS> {

View File

@ -1,6 +1,6 @@
use std::ops::Neg;
use {Float, Num, NumCast};
use crate::{Float, Num, NumCast};
// NOTE: These doctests have the same issue as those in src/float.rs.
// They're testing the inherent methods directly, and not those of `Real`.

View File

@ -1,8 +1,8 @@
use core::num::Wrapping;
use core::ops::Neg;
use float::FloatCore;
use Num;
use crate::float::FloatCore;
use crate::Num;
/// Useful functions for signed numbers (i.e. numbers that can be negative).
pub trait Signed: Sized + Num + Neg<Output = Self> {