Skip to content

Commit ff004ed

Browse files
authored
Merge pull request #419 from wedsonaf/clippy
binder: fix clippy warnings when rust_2018_idioms is enabled.
2 parents d45e2ca + 0ebc358 commit ff004ed

File tree

6 files changed

+16
-16
lines changed

6 files changed

+16
-16
lines changed

drivers/android/context.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3-
extern crate alloc;
4-
53
use kernel::{
64
bindings,
75
prelude::*,

drivers/android/node.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,12 +248,16 @@ impl Node {
248248

249249
pub(crate) fn next_death(
250250
&self,
251-
guard: &mut Guard<Mutex<ProcessInner>>,
251+
guard: &mut Guard<'_, Mutex<ProcessInner>>,
252252
) -> Option<Arc<NodeDeath>> {
253253
self.inner.access_mut(guard).death_list.pop_front()
254254
}
255255

256-
pub(crate) fn add_death(&self, death: Arc<NodeDeath>, guard: &mut Guard<Mutex<ProcessInner>>) {
256+
pub(crate) fn add_death(
257+
&self,
258+
death: Arc<NodeDeath>,
259+
guard: &mut Guard<'_, Mutex<ProcessInner>>,
260+
) {
257261
self.inner.access_mut(guard).death_list.push_back(death);
258262
}
259263

@@ -306,7 +310,7 @@ impl Node {
306310
pub(crate) fn populate_counts(
307311
&self,
308312
out: &mut BinderNodeInfoForRef,
309-
guard: &Guard<Mutex<ProcessInner>>,
313+
guard: &Guard<'_, Mutex<ProcessInner>>,
310314
) {
311315
let inner = self.inner.access(guard);
312316
out.strong_count = inner.strong.count as _;
@@ -316,7 +320,7 @@ impl Node {
316320
pub(crate) fn populate_debug_info(
317321
&self,
318322
out: &mut BinderNodeDebugInfo,
319-
guard: &Guard<Mutex<ProcessInner>>,
323+
guard: &Guard<'_, Mutex<ProcessInner>>,
320324
) {
321325
out.ptr = self.ptr as _;
322326
out.cookie = self.cookie as _;
@@ -329,7 +333,7 @@ impl Node {
329333
}
330334
}
331335

332-
pub(crate) fn force_has_count(&self, guard: &mut Guard<Mutex<ProcessInner>>) {
336+
pub(crate) fn force_has_count(&self, guard: &mut Guard<'_, Mutex<ProcessInner>>) {
333337
let inner = self.inner.access_mut(guard);
334338
inner.strong.has_count = true;
335339
inner.weak.has_count = true;

drivers/android/process.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl Process {
545545
Ok(())
546546
}
547547

548-
pub(crate) fn buffer_alloc(&self, size: usize) -> BinderResult<Allocation> {
548+
pub(crate) fn buffer_alloc(&self, size: usize) -> BinderResult<Allocation<'_>> {
549549
let mut inner = self.inner.lock();
550550
let mapping = inner.mapping.as_mut().ok_or_else(BinderError::new_dead)?;
551551

@@ -560,7 +560,7 @@ impl Process {
560560
}
561561

562562
// TODO: Review if we want an Option or a Result.
563-
pub(crate) fn buffer_get(&self, ptr: usize) -> Option<Allocation> {
563+
pub(crate) fn buffer_get(&self, ptr: usize) -> Option<Allocation<'_>> {
564564
let mut inner = self.inner.lock();
565565
let mapping = inner.mapping.as_mut()?;
566566
let offset = ptr.checked_sub(mapping.address)?;
@@ -960,7 +960,7 @@ impl<'a> Registration<'a> {
960960
fn new(
961961
process: &'a Process,
962962
thread: &'a Arc<Thread>,
963-
guard: &mut Guard<Mutex<ProcessInner>>,
963+
guard: &mut Guard<'_, Mutex<ProcessInner>>,
964964
) -> Self {
965965
guard.ready_threads.push_back(thread.clone());
966966
Self { process, thread }

drivers/android/range_alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl<T> RangeAllocator<T> {
7070
Ok(desc.offset)
7171
}
7272

73-
fn free_with_cursor(cursor: &mut CursorMut<Box<Descriptor<T>>>) -> Result {
73+
fn free_with_cursor(cursor: &mut CursorMut<'_, Box<Descriptor<T>>>) -> Result {
7474
let mut size = match cursor.current() {
7575
None => return Err(Error::EINVAL),
7676
Some(ref mut entry) => {
@@ -105,7 +105,7 @@ impl<T> RangeAllocator<T> {
105105
Ok(())
106106
}
107107

108-
fn find_at_offset(&mut self, offset: usize) -> Option<CursorMut<Box<Descriptor<T>>>> {
108+
fn find_at_offset(&mut self, offset: usize) -> Option<CursorMut<'_, Box<Descriptor<T>>>> {
109109
let mut cursor = self.list.cursor_front_mut();
110110
while let Some(desc) = cursor.current() {
111111
if desc.offset == offset {

drivers/android/rust_binder.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
77
#![no_std]
88
#![feature(global_asm, try_reserve, allocator_api, concat_idents)]
9-
// TODO: clean these up
10-
#![allow(rust_2018_idioms)]
119

1210
use alloc::{boxed::Box, sync::Arc};
1311
use core::pin::Pin;

drivers/android/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ impl Thread {
374374
fn translate_object(
375375
&self,
376376
index_offset: usize,
377-
view: &mut AllocationView,
377+
view: &mut AllocationView<'_, '_>,
378378
allow_fds: bool,
379379
) -> BinderResult {
380380
let offset = view.alloc.read(index_offset)?;
@@ -432,7 +432,7 @@ impl Thread {
432432

433433
fn translate_objects(
434434
&self,
435-
alloc: &mut Allocation,
435+
alloc: &mut Allocation<'_>,
436436
start: usize,
437437
end: usize,
438438
allow_fds: bool,

0 commit comments

Comments
 (0)