Skip to content

Commit 1aef03b

Browse files
committed
chore(clippy): flowing lifetimes warning and clippy::mut_from_ref
- lifetime flowing from input to output with different syntax can be confusing - mutable borrow from immutable input(s)
1 parent 660f308 commit 1aef03b

File tree

6 files changed

+8
-7
lines changed

6 files changed

+8
-7
lines changed

src/types/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ impl ZendHashTable {
534534
/// }
535535
#[inline]
536536
#[must_use]
537-
pub fn values(&self) -> Values {
537+
pub fn values(&self) -> Values<'_> {
538538
Values::new(self)
539539
}
540540

@@ -559,7 +559,7 @@ impl ZendHashTable {
559559
/// }
560560
#[inline]
561561
#[must_use]
562-
pub fn iter(&self) -> Iter {
562+
pub fn iter(&self) -> Iter<'_> {
563563
self.into_iter()
564564
}
565565
}

src/types/iterable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl Iterable<'_> {
1919
/// May return None if a Traversable cannot be rewound.
2020
// TODO: Check iter not returning iterator
2121
#[allow(clippy::iter_not_returning_iterator)]
22-
pub fn iter(&mut self) -> Option<Iter> {
22+
pub fn iter(&mut self) -> Option<Iter<'_>> {
2323
match self {
2424
Iterable::Array(array) => Some(Iter::Array(array.iter())),
2525
Iterable::Traversable(traversable) => Some(Iter::Traversable(traversable.iter()?)),

src/types/iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl ZendIterator {
2323
/// iterator cannot be rewound.
2424
// TODO: Check iter not returning iterator
2525
#[allow(clippy::iter_not_returning_iterator)]
26-
pub fn iter(&mut self) -> Option<Iter> {
26+
pub fn iter(&mut self) -> Option<Iter<'_>> {
2727
self.index = 0;
2828

2929
if self.rewind() {

src/types/zval.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl Zval {
291291

292292
/// Returns the value of the zval if it is callable.
293293
#[must_use]
294-
pub fn callable(&self) -> Option<ZendCallable> {
294+
pub fn callable(&self) -> Option<ZendCallable<'_>> {
295295
// The Zval is checked if it is callable in the `new` function.
296296
ZendCallable::new(self).ok()
297297
}
@@ -309,7 +309,7 @@ impl Zval {
309309
/// Returns an iterable over the zval if it is an array or traversable. (is
310310
/// iterable)
311311
#[must_use]
312-
pub fn iterable(&self) -> Option<Iterable> {
312+
pub fn iterable(&self) -> Option<Iterable<'_>> {
313313
if self.is_iterable() {
314314
Iterable::from_zval(self)
315315
} else {

src/zend/linked_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub type ZendLinkedList = zend_llist;
88
impl ZendLinkedList {
99
/// Create an iterator over the linked list
1010
#[must_use]
11-
pub fn iter<T>(&self) -> ZendLinkedListIterator<T> {
11+
pub fn iter<T>(&self) -> ZendLinkedListIterator<'_, T> {
1212
ZendLinkedListIterator::new(self)
1313
}
1414
}

src/zend/streams.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ impl StreamWrapper {
4141

4242
/// Get mutable wrapped stream by name
4343
#[must_use]
44+
#[allow(clippy::mut_from_ref)]
4445
pub fn get_mut(name: &str) -> Option<&mut Self> {
4546
unsafe {
4647
let result = php_stream_locate_url_wrapper(name.as_ptr().cast(), ptr::null_mut(), 0);

0 commit comments

Comments
 (0)