Skip to content

Commit 891fa4a

Browse files
committed
Cargo fmt
1 parent c87c0dc commit 891fa4a

File tree

7 files changed

+35
-20
lines changed

7 files changed

+35
-20
lines changed

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub mod zend;
3535
/// A module typically glob-imported containing the typically required macros
3636
/// and imports.
3737
pub mod prelude {
38-
38+
3939
pub use crate::builders::ModuleBuilder;
4040
#[cfg(any(docs, feature = "closure"))]
4141
#[cfg_attr(docs, doc(cfg(feature = "closure")))]

src/types/object.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ use crate::{
99
convert::{FromZendObject, FromZval, FromZvalMut, IntoZval, IntoZvalDyn},
1010
error::{Error, Result},
1111
ffi::{
12-
ext_php_rs_zend_object_release, zend_call_known_function, zend_object, zend_objects_new,
13-
HashTable, ZEND_ISEMPTY, ZEND_PROPERTY_EXISTS, ZEND_PROPERTY_ISSET, zend_hash_str_find_ptr_lc, zend_function, object_properties_init,
12+
ext_php_rs_zend_object_release, object_properties_init, zend_call_known_function,
13+
zend_function, zend_hash_str_find_ptr_lc, zend_object, zend_objects_new, HashTable,
14+
ZEND_ISEMPTY, ZEND_PROPERTY_EXISTS, ZEND_PROPERTY_ISSET,
1415
},
1516
flags::DataType,
1617
rc::PhpRc,
@@ -49,8 +50,8 @@ impl ZendObject {
4950
}
5051
object_properties_init(ptr, ce as *const _ as *mut _);
5152
ptr
52-
},
53-
Some(v) => v(ce as *const _ as *mut _)
53+
}
54+
Some(v) => v(ce as *const _ as *mut _),
5455
};
5556

5657
ZBox::from_raw(
@@ -132,7 +133,6 @@ impl ZendObject {
132133
(self.ce as *const ClassEntry).eq(&(T::get_metadata().ce() as *const _))
133134
}
134135

135-
136136
#[inline(always)]
137137
pub fn try_call_method(&self, name: &str, params: Vec<&dyn IntoZvalDyn>) -> Result<Zval> {
138138
let mut retval = Zval::new();
@@ -147,10 +147,10 @@ impl ZendObject {
147147
let res = zend_hash_str_find_ptr_lc(
148148
&(*self.ce).function_table,
149149
name.as_ptr() as *const i8,
150-
name.len()
150+
name.len(),
151151
) as *mut zend_function;
152152
if res.is_null() {
153-
return Err(Error::Callable)
153+
return Err(Error::Callable);
154154
}
155155
zend_call_known_function(
156156
res,

src/types/zval.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,9 @@ impl Zval {
208208

209209
#[inline(always)]
210210
pub fn try_call_method(&self, name: &str, params: Vec<&dyn IntoZvalDyn>) -> Result<Zval> {
211-
self.object().ok_or(Error::Object)?.try_call_method(name, params)
211+
self.object()
212+
.ok_or(Error::Object)?
213+
.try_call_method(name, params)
212214
}
213215

214216
/// Returns the value of the zval if it is a reference.

src/zend/class.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
//! Builder and objects for creating classes in the PHP world.
22
3-
use crate::{ffi::{zend_class_entry}, flags::ClassFlags, types::{ZendStr, ZendObject}, zend::ExecutorGlobals, boxed::ZBox};
3+
use crate::{
4+
boxed::ZBox,
5+
ffi::zend_class_entry,
6+
flags::ClassFlags,
7+
types::{ZendObject, ZendStr},
8+
zend::ExecutorGlobals,
9+
};
410
use std::{convert::TryInto, fmt::Debug, ops::DerefMut};
511

612
/// A PHP class entry.

src/zend/function.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
//! Builder for creating functions and methods in PHP.
22
3-
use std::{fmt::Debug, os::raw::c_char, ptr::self};
3+
use std::{fmt::Debug, os::raw::c_char, ptr};
44

5-
use crate::{ffi::{zend_function_entry, zend_fetch_function_str, zend_function, zend_hash_str_find_ptr_lc, zend_call_known_function}, convert::IntoZvalDyn, types::Zval, error::Result};
5+
use crate::{
6+
convert::IntoZvalDyn,
7+
error::Result,
8+
ffi::{
9+
zend_call_known_function, zend_fetch_function_str, zend_function, zend_function_entry,
10+
zend_hash_str_find_ptr_lc,
11+
},
12+
types::Zval,
13+
};
614

715
use super::ClassEntry;
816

@@ -58,14 +66,14 @@ impl Function {
5866
let res = zend_hash_str_find_ptr_lc(
5967
&ce.function_table,
6068
name.as_ptr() as *const i8,
61-
name.len()
69+
name.len(),
6270
) as *mut zend_function;
6371
if res.is_null() {
64-
return None
72+
return None;
6573
}
66-
return Some(*res)
67-
}
68-
}
74+
return Some(*res);
75+
},
76+
};
6977
}
7078

7179
pub fn from_function(name: &str) -> Self {

src/zend/globals.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::ops::{Deref, DerefMut};
44

55
use parking_lot::{const_rwlock, RwLock, RwLockReadGuard, RwLockWriteGuard};
66

7-
87
use crate::boxed::ZBox;
98
#[cfg(php82)]
109
use crate::ffi::zend_atomic_bool_store;
@@ -144,4 +143,4 @@ impl<T> DerefMut for GlobalWriteGuard<T> {
144143
fn deref_mut(&mut self) -> &mut Self::Target {
145144
self.globals
146145
}
147-
}
146+
}

src/zend/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use std::ffi::CString;
1515
pub use _type::ZendType;
1616
pub use class::ClassEntry;
1717
pub use ex::ExecuteData;
18-
pub use function::FunctionEntry;
1918
pub use function::Function;
19+
pub use function::FunctionEntry;
2020
pub use globals::ExecutorGlobals;
2121
pub use handlers::ZendObjectHandlers;
2222
pub use module::ModuleEntry;

0 commit comments

Comments
 (0)