Skip to content

Commit e5fa9cc

Browse files
committed
Fix fallout from wrapping_neg revert
1 parent a21ffcf commit e5fa9cc

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/libcore/num/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ macro_rules! int_impl {
506506
#[inline]
507507
pub fn abs(self) -> $T {
508508
if self.is_negative() {
509-
self.wrapping_neg()
509+
-self
510510
} else {
511511
self
512512
}

src/libserialize/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ impl<T: Iterator<Item=char>> Parser<T> {
15381538
F64Value(res)
15391539
} else {
15401540
if neg {
1541-
let res = (res as i64).wrapping_neg();
1541+
let res = -(res as i64);
15421542

15431543
// Make sure we didn't underflow.
15441544
if res > 0 {

0 commit comments

Comments
 (0)