Skip to content

Commit 976bc7d

Browse files
Fix clippy errors
1 parent 231b300 commit 976bc7d

File tree

7 files changed

+16
-13
lines changed

7 files changed

+16
-13
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ impl PHPInfo {
131131
fn build_wrapper(defines: &[(&str, &str)], includes: &[PathBuf]) -> Result<()> {
132132
let mut build = cc::Build::new();
133133
for (var, val) in defines {
134-
build.define(*var, *val);
134+
build.define(var, *val);
135135
}
136136
build
137137
.file("src/wrapper.c")

src/boxed.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,14 @@ impl<T: ZBoxable> DerefMut for ZBox<T> {
9797
impl<T: ZBoxable + Debug> Debug for ZBox<T> {
9898
#[inline]
9999
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
100-
(&**self).fmt(f)
100+
(**self).fmt(f)
101101
}
102102
}
103103

104104
impl<T: ZBoxable> Borrow<T> for ZBox<T> {
105105
#[inline]
106106
fn borrow(&self) -> &T {
107-
&**self
107+
self
108108
}
109109
}
110110

src/props.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ impl<'a, T: Clone + IntoZval + FromZval<'a>> Prop<'a> for T {
5959
}
6060
}
6161

62+
pub type PropertyGetter<'a, T> = Option<Box<dyn Fn(&T, &mut Zval) -> PhpResult + Send + Sync + 'a>>;
63+
pub type PropertySetter<'a, T> = Option<Box<dyn Fn(&mut T, &Zval) -> PhpResult + Send + Sync + 'a>>;
64+
6265
/// Represents a property added to a PHP class.
6366
///
6467
/// There are two types of properties:
@@ -69,8 +72,8 @@ impl<'a, T: Clone + IntoZval + FromZval<'a>> Prop<'a> for T {
6972
pub enum Property<'a, T> {
7073
Field(Box<dyn (Fn(&mut T) -> &mut dyn Prop) + Send + Sync>),
7174
Method {
72-
get: Option<Box<dyn Fn(&T, &mut Zval) -> PhpResult + Send + Sync + 'a>>,
73-
set: Option<Box<dyn Fn(&mut T, &Zval) -> PhpResult + Send + Sync + 'a>>,
75+
get: PropertyGetter<'a, T>,
76+
set: PropertySetter<'a, T>,
7477
},
7578
}
7679

src/types/callable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ enum OwnedZval<'a> {
160160
impl<'a> OwnedZval<'a> {
161161
fn as_ref(&self) -> &Zval {
162162
match self {
163-
OwnedZval::Reference(zv) => *zv,
163+
OwnedZval::Reference(zv) => zv,
164164
OwnedZval::Owned(zv) => zv,
165165
}
166166
}

src/types/class_object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ impl<T: RegisteredClass + Clone> Clone for ZBox<ZendClassObject<T>> {
260260
// `ZendClassObject` pointer will contain a valid, initialized `obj`,
261261
// therefore we can dereference both safely.
262262
unsafe {
263-
let mut new = ZendClassObject::new((&***self).clone());
263+
let mut new = ZendClassObject::new((***self).clone());
264264
zend_objects_clone_members(&mut new.std, &self.std as *const _ as *mut _);
265265
new
266266
}

src/zend/ex.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl ExecuteData {
4242
/// dbg!(a);
4343
/// }
4444
/// ```
45-
pub fn parser<'a>(&'a mut self) -> ArgParser<'a, '_> {
45+
pub fn parser(&mut self) -> ArgParser<'_, '_> {
4646
self.parser_object().0
4747
}
4848

@@ -73,7 +73,7 @@ impl ExecuteData {
7373
/// dbg!(a, this);
7474
/// }
7575
/// ```
76-
pub fn parser_object<'a>(&'a mut self) -> (ArgParser<'a, '_>, Option<&'a mut ZendObject>) {
76+
pub fn parser_object(&mut self) -> (ArgParser<'_, '_>, Option<&mut ZendObject>) {
7777
// SAFETY: All fields of the `u2` union are the same type.
7878
let n_args = unsafe { self.This.u2.num_args };
7979
let mut args = vec![];
@@ -134,9 +134,9 @@ impl ExecuteData {
134134
/// ```
135135
///
136136
/// [`parse_object`]: #method.parse_object
137-
pub fn parser_method<'a, T: RegisteredClass>(
138-
&'a mut self,
139-
) -> (ArgParser<'a, '_>, Option<&'a mut ZendClassObject<T>>) {
137+
pub fn parser_method<T: RegisteredClass>(
138+
&mut self,
139+
) -> (ArgParser<'_, '_>, Option<&mut ZendClassObject<T>>) {
140140
let (parser, obj) = self.parser_object();
141141
(
142142
parser,

src/zend/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl ZendObjectHandlers {
110110
Ok(rv) => rv,
111111
Err(e) => {
112112
let _ = e.throw();
113-
(&mut *rv).set_null();
113+
(*rv).set_null();
114114
rv
115115
}
116116
}

0 commit comments

Comments
 (0)