Skip to content

Commit d2d0c2f

Browse files
committed
Migrate to Rust 2021.
1 parent 2f287ff commit d2d0c2f

File tree

6 files changed

+13
-19
lines changed

6 files changed

+13
-19
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "rustc_apfloat"
33
version = "0.0.0"
4+
edition = "2021"
45

56
[dependencies]
67
bitflags = "1.3.2"

src/ieee.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use {Category, ExpInt, IEK_INF, IEK_NAN, IEK_ZERO};
2-
use {Float, FloatConvert, ParseError, Round, Status, StatusAnd};
1+
use crate::{Category, ExpInt, IEK_INF, IEK_NAN, IEK_ZERO};
2+
use crate::{Float, FloatConvert, ParseError, Round, Status, StatusAnd};
33

44
use alloc::vec::Vec;
55
use core::cmp::{self, Ordering};
@@ -325,7 +325,7 @@ impl<S> Neg for IeeeFloat<S> {
325325
/// 1.01E-2 4 2 0.0101
326326
/// 1.01E-2 4 1 1.01E-2
327327
impl<S: Semantics> fmt::Display for IeeeFloat<S> {
328-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
328+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
329329
let width = f.width().unwrap_or(3);
330330
let alternate = f.alternate();
331331

@@ -616,7 +616,7 @@ impl<S: Semantics> fmt::Display for IeeeFloat<S> {
616616
}
617617

618618
impl<S: Semantics> fmt::Debug for IeeeFloat<S> {
619-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
619+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
620620
write!(f, "{}({:?} | {}{:?} * 2^{})",
621621
self, self.category,
622622
if self.sign { "-" } else { "+" },
@@ -1425,7 +1425,7 @@ impl<S: Semantics> Float for IeeeFloat<S> {
14251425
let max_change = S::MAX_EXP as i32 - (S::MIN_EXP as i32 - sig_bits) + 1;
14261426

14271427
// Clamp to one past the range ends to let normalize handle overflow.
1428-
let exp_change = cmp::min(cmp::max(exp as i32, (-max_change - 1)), max_change);
1428+
let exp_change = cmp::min(cmp::max(exp as i32, -max_change - 1), max_change);
14291429
self.exp = self.exp.saturating_add(exp_change as ExpInt);
14301430
self = self.normalize(round, Loss::ExactlyZero).value;
14311431
if self.is_nan() {
@@ -1744,9 +1744,9 @@ impl<S: Semantics> IeeeFloat<S> {
17441744
} else {
17451745
loss = Some(match hex_value {
17461746
0 => Loss::ExactlyZero,
1747-
1...7 => Loss::LessThanHalf,
1747+
1..=7 => Loss::LessThanHalf,
17481748
8 => Loss::ExactlyHalf,
1749-
9...15 => Loss::MoreThanHalf,
1749+
9..=15 => Loss::MoreThanHalf,
17501750
_ => unreachable!(),
17511751
});
17521752
}

src/lib.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,9 @@
3030
//! This API is completely unstable and subject to change.
3131
3232
#![no_std]
33-
// #![deny(warnings)]
33+
#![deny(warnings)]
3434
#![forbid(unsafe_code)]
3535

36-
#![feature(min_const_fn)]
37-
#![feature(i128_type)]
38-
#![feature(slice_patterns)]
39-
#![feature(try_from)]
40-
4136
#[macro_use]
4237
extern crate bitflags;
4338

src/ppc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use {Category, ExpInt, Float, FloatConvert, Round, ParseError, Status, StatusAnd};
2-
use ieee;
1+
use crate::{Category, ExpInt, Float, FloatConvert, Round, ParseError, Status, StatusAnd};
2+
use crate::ieee;
33

44
use core::cmp::Ordering;
55
use core::fmt;
@@ -124,7 +124,7 @@ impl<F: Float> Neg for DoubleFloat<F> {
124124
}
125125

126126
impl<F: FloatConvert<Fallback<F>>> fmt::Display for DoubleFloat<F> {
127-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
127+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
128128
fmt::Display::fmt(&Fallback::from(*self), f)
129129
}
130130
}

tests/ieee.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(i128_type)]
2-
31
#[macro_use]
42
extern crate rustc_apfloat;
53

tests/ppc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
extern crate rustc_apfloat;
1+
22

33
use rustc_apfloat::{Category, Float, Round};
44
use rustc_apfloat::ppc::DoubleDouble;

0 commit comments

Comments
 (0)