Skip to content

Commit be67092

Browse files
committed
Fix rule for float
1 parent 7f9df00 commit be67092

9 files changed

Lines changed: 12 additions & 13 deletions

File tree

‎rules/builtin_types/tgt_unsafe.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn t3() -> *const bool {
1414
}
1515

1616
fn t4() -> f32 {
17-
0.0_f32
17+
0_f32
1818
}
1919

2020
fn t5() -> *mut f32 {
@@ -26,7 +26,7 @@ fn t6() -> *const f32 {
2626
}
2727

2828
fn t7() -> f64 {
29-
0.0_f64
29+
0_f64
3030
}
3131

3232
fn t8() -> *mut f64 {
@@ -186,7 +186,7 @@ fn t46() -> ::libc::c_void {
186186
}
187187

188188
fn t47() -> f64 {
189-
0.0_f64
189+
0_f64
190190
}
191191

192192
fn t48() -> i32 {

‎tests/unit/out/refcount/scalar_builtin_construct_destruct.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn main() {
5050
}
5151
fn main_0() -> i32 {
5252
let i: Value<i32> = Rc::new(RefCell::new(0_i32));
53-
let d: Value<f64> = Rc::new(RefCell::new(0.0_f64));
53+
let d: Value<f64> = Rc::new(RefCell::new(0_f64));
5454
let p: Value<Ptr<i32>> = Rc::new(RefCell::new(({ zero_0() })));
5555
assert!(((*i.borrow()) == 0));
5656
assert!(((*d.borrow()) == 0.0E+0));

‎tests/unit/out/refcount/static_local.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ pub fn foo_0() -> i32 {
1111
static static_i_1: Value<i32> = Rc::new(RefCell::new(0_i32));
1212
);
1313
thread_local!(
14-
static static_f_2: Value<f32> = Rc::new(RefCell::new(0.0_f32));
14+
static static_f_2: Value<f32> = Rc::new(RefCell::new(0_f32));
1515
);
1616
thread_local!(
1717
static static_b_3: Value<bool> = Rc::new(RefCell::new(false));

‎tests/unit/out/refcount/types.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn main_0() -> i32 {
2727
let xc8: Value<u8> = Rc::new(RefCell::new(66_u8));
2828
let xc16: Value<u16> = Rc::new(RefCell::new(67_u16));
2929
let xc32: Value<u32> = Rc::new(RefCell::new(68_u32));
30-
let xnp: Value<Value<AnyPtr>> = Rc::new(RefCell::new(Default::default()));
30+
let xnp: Value<AnyPtr> = Rc::new(RefCell::new(Default::default()));
3131
assert!(
3232
(((((((((((((*xu8.borrow()) as i32) + ((*xu16.borrow()) as i32)) as u32)
3333
.wrapping_add((*xu32.borrow()))) as u64)
@@ -46,7 +46,7 @@ fn main_0() -> i32 {
4646
.wrapping_add((*xc32.borrow()))
4747
== 266_u32)
4848
);
49-
assert!((<AnyPtr>::default()).is_null());
49+
assert!((AnyPtr::default()).is_null());
5050
return 0;
5151
}
5252
pub fn __cpp2rust_init_globals() {}

‎tests/unit/out/refcount/vector_with_allocator.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ pub trait TestAllocator_double_Impl {
315315
impl TestAllocator_double_Impl for Ptr<TestAllocator_double_> {
316316
fn allocate(&self, n: usize) -> Ptr<f64> {
317317
let n: Value<usize> = Rc::new(RefCell::new(n));
318-
return Ptr::alloc_array((0..(*n.borrow())).map(|_| 0.0_f64).collect::<Box<[f64]>>());
318+
return Ptr::alloc_array((0..(*n.borrow())).map(|_| 0_f64).collect::<Box<[f64]>>());
319319
}
320320
fn deallocate(&self, p: Ptr<f64>, _a1: usize) {
321321
let p: Value<Ptr<f64>> = Rc::new(RefCell::new(p));

‎tests/unit/out/unsafe/scalar_builtin_construct_destruct.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn main() {
2727
}
2828
unsafe fn main_0() -> i32 {
2929
let mut i: i32 = 0_i32;
30-
let mut d: f64 = 0.0_f64;
30+
let mut d: f64 = 0_f64;
3131
let mut p: *mut i32 = (unsafe { zero_0() });
3232
assert!(((i) == (0)));
3333
assert!(((d) == (0.0E+0)));

‎tests/unit/out/unsafe/static_local.rs‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ use std::os::fd::{AsFd, FromRawFd, IntoRawFd};
88
use std::rc::Rc;
99
pub unsafe fn foo_0() -> i32 {
1010
static mut static_i_1: std::cell::LazyCell<i32> = std::cell::LazyCell::new(|| unsafe { 0_i32 });;
11-
static mut static_f_2: std::cell::LazyCell<f32> =
12-
std::cell::LazyCell::new(|| unsafe { 0.0_f32 });;
11+
static mut static_f_2: std::cell::LazyCell<f32> = std::cell::LazyCell::new(|| unsafe { 0_f32 });;
1312
static mut static_b_3: std::cell::LazyCell<bool> =
1413
std::cell::LazyCell::new(|| unsafe { false });;
1514
static mut kX1_4: std::cell::LazyCell<i32> = std::cell::LazyCell::new(|| unsafe { 1 });;

‎tests/unit/out/unsafe/types.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ unsafe fn main_0() -> i32 {
4343
);
4444
assert!((((xld) * (2_f64)) == (3_f64)));
4545
assert!(((((((xwc) + (xc8 as i32)) + (xc16 as i32)) as u32).wrapping_add(xc32)) == (266_u32)));
46-
assert!((<*mut ::libc::c_void>::default()).is_null());
46+
assert!((std::ptr::null_mut::<::libc::c_void>()).is_null());
4747
return 0;
4848
}
4949
pub unsafe fn __cpp2rust_init_globals() {}

‎tests/unit/out/unsafe/vector_with_allocator.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ impl TestAllocator_int_ {
2525
pub struct TestAllocator_double_ {}
2626
impl TestAllocator_double_ {
2727
pub unsafe fn allocate(&mut self, mut n: usize) -> *mut f64 {
28-
return Box::leak((0..n).map(|_| 0.0_f64).collect::<Box<[f64]>>()).as_mut_ptr();
28+
return Box::leak((0..n).map(|_| 0_f64).collect::<Box<[f64]>>()).as_mut_ptr();
2929
}
3030
pub unsafe fn deallocate(&mut self, mut p: *mut f64, mut _a1: usize) {
3131
::std::mem::drop(Box::from_raw(::std::slice::from_raw_parts_mut(

0 commit comments

Comments
 (0)