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

Revert "Auto merge of #296 - vks:no_std, r=cuviper" #301

Merged
merged 1 commit into from
Jun 9, 2017
Merged
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
4 changes: 0 additions & 4 deletions traits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ name = "num-traits"
version = "0.1.38"

[dependencies]

[features]
default = ["std"]
std = []
8 changes: 4 additions & 4 deletions traits/src/bounds.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::{usize, u8, u16, u32, u64};
use core::{isize, i8, i16, i32, i64};
use core::{f32, f64};
use core::num::Wrapping;
use std::{usize, u8, u16, u32, u64};
use std::{isize, i8, i16, i32, i64};
use std::{f32, f64};
use std::num::Wrapping;

/// Numbers which have upper and lower bounds
pub trait Bounded {
Expand Down
13 changes: 6 additions & 7 deletions traits/src/cast.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use core::mem::size_of;
use core::num::Wrapping;
use std::mem::size_of;
use std::num::Wrapping;

use identities::Zero;
use bounds::Bounded;
use float::Float;

/// A generic trait for converting a value to a number.
pub trait ToPrimitive {
Expand Down Expand Up @@ -227,8 +226,8 @@ macro_rules! impl_to_primitive_float_to_float {
// Make sure the value is in range for the cast.
// NaN and +-inf are cast as they are.
let n = $slf as f64;
let max_value: $DstT = ::core::$DstT::MAX;
if !Float::is_finite(n) || (-max_value as f64 <= n && n <= max_value as f64) {
let max_value: $DstT = ::std::$DstT::MAX;
if !n.is_finite() || (-max_value as f64 <= n && n <= max_value as f64) {
Some($slf as $DstT)
} else {
None
Expand Down Expand Up @@ -455,8 +454,8 @@ impl<T: NumCast> NumCast for Wrapping<T> {

#[test]
fn to_primitive_float() {
use core::f32;
use core::f64;
use std::f32;
use std::f64;

let f32_toolarge = 1e39f64;
assert_eq!(f32_toolarge.to_f32(), None);
Expand Down
Loading