Skip to content

Commit 3eff2cb

Browse files
committed
format
1 parent 6995d6a commit 3eff2cb

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

phper/src/classes.rs

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use crate::{
2424
};
2525
use std::{
2626
any::Any,
27-
ffi::{c_void, CString, c_char},
27+
ffi::{c_char, c_void, CString},
2828
fmt::Debug,
2929
marker::PhantomData,
3030
mem::{replace, size_of, zeroed, ManuallyDrop},
@@ -490,8 +490,7 @@ impl<T: 'static> ClassEntity<T> {
490490
}
491491

492492
/// Add constant to class
493-
pub fn add_constant(
494-
&mut self, name: impl Into<String>, value: impl Into<Scalar>) {
493+
pub fn add_constant(&mut self, name: impl Into<String>, value: impl Into<Scalar>) {
495494
let constant = ConstantEntity::new(name, value);
496495
self.constants.push(constant);
497496
}
@@ -720,8 +719,7 @@ impl InterfaceEntity {
720719
}
721720

722721
/// Add constant to interface
723-
pub fn add_constant(
724-
&mut self, name: impl Into<String>, value: impl Into<Scalar>) {
722+
pub fn add_constant(&mut self, name: impl Into<String>, value: impl Into<Scalar>) {
725723
let constant = ConstantEntity::new(name, value);
726724
self.constants.push(constant);
727725
}
@@ -1020,24 +1018,13 @@ unsafe fn add_class_constant(class_ce: *mut _zend_class_entry, constant: &Consta
10201018
unsafe {
10211019
match &constant.value {
10221020
Scalar::Null => zend_declare_class_constant_null(class_ce, name_ptr, name_len),
1023-
Scalar::Bool(b) => zend_declare_class_constant_bool(
1024-
class_ce,
1025-
name_ptr,
1026-
name_len,
1027-
*b as zend_bool,
1028-
),
1029-
Scalar::I64(i) => zend_declare_class_constant_long(
1030-
class_ce,
1031-
name_ptr,
1032-
name_len,
1033-
*i as zend_long,
1034-
),
1035-
Scalar::F64(f) => zend_declare_class_constant_double(
1036-
class_ce,
1037-
name_ptr,
1038-
name_len,
1039-
*f
1040-
),
1021+
Scalar::Bool(b) => {
1022+
zend_declare_class_constant_bool(class_ce, name_ptr, name_len, *b as zend_bool)
1023+
}
1024+
Scalar::I64(i) => {
1025+
zend_declare_class_constant_long(class_ce, name_ptr, name_len, *i as zend_long)
1026+
}
1027+
Scalar::F64(f) => zend_declare_class_constant_double(class_ce, name_ptr, name_len, *f),
10411028
Scalar::String(s) => {
10421029
let s_ptr = s.as_ptr() as *mut u8;
10431030
zend_declare_class_constant_stringl(

0 commit comments

Comments
 (0)