Skip to content

Commit de2f00e

Browse files
committed
Merge branch '🚨-clippy' into 🦆
2 parents 8864459 + 7e381b2 commit de2f00e

File tree

29 files changed

+111
-71
lines changed

29 files changed

+111
-71
lines changed

‎src/r3/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- **Breaking:** Remove unused lifetime parameters from `r3::sync::{recursive_,}mutex::Definer::wrap_hunk_unchedked`
13+
1014
## [0.2.4] - 2022-11-16
1115

1216
### Changed

‎src/r3/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![feature(type_alias_impl_trait)]
44
#![feature(const_trait_impl)]
55
#![feature(const_mut_refs)]
6+
#![feature(lint_reasons)]
67
#![feature(cell_update)]
78
#![feature(decl_macro)]
89
#![feature(doc_cfg)]

‎src/r3/src/sync/source.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,7 @@ macro_rules! impl_source_setter {
353353
)?
354354
///
355355
/// [Take]: crate::bind::Bind::take_mut
356+
#[expect(clippy::needless_lifetimes)] // `'pool`
356357
pub const fn take_bind<'pool>(
357358
self,
358359
bind: __pr::Bind<'pool, System, AutoWrapped<T>>,
@@ -387,7 +388,7 @@ macro_rules! impl_source_setter {
387388
/// `UnsafeCell`'s contents based on the assumption that no accesses
388389
/// are made through other means, and that `T` is initialized by
389390
/// the time the boot phase completes.
390-
pub const unsafe fn wrap_hunk_unchecked<'pool>(
391+
pub const unsafe fn wrap_hunk_unchecked(
391392
self,
392393
hunk: __pr::Hunk<System, __pr::UnsafeCell<__pr::MaybeUninit<AutoWrapped<T>>>>,
393394
) -> Definer!(__pr::HunkSource<System, AutoWrapped<T>>)

‎src/r3_core/src/bind.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1778,6 +1778,9 @@ where
17781778

17791779
fn register_dependency(&self, ctx: &mut CfgBindCtx<'_>) {
17801780
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
1781+
// FIXME: `needless_range_loop` false positive
1782+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
1783+
#[expect(clippy::needless_range_loop)]
17811784
for i in 0..LEN {
17821785
self[i].register_dependency(ctx);
17831786
}
@@ -1789,6 +1792,9 @@ where
17891792
let mut out = MaybeUninit::uninit_array();
17901793
let this = MaybeUninit::new(self);
17911794
// `[T]::iter_mut` is unusable in `const fn` [ref:const_slice_iter]
1795+
// FIXME: `needless_range_loop` false positive
1796+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
1797+
#[expect(clippy::needless_range_loop)]
17921798
for i in 0..LEN {
17931799
out[i] = MaybeUninit::new(
17941800
this.as_ptr()

‎src/r3_core/src/bind/sorter.rs

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,9 @@ pub(super) const fn sort_bindings<Callback, SorterUseInfoList, VertexList>(
167167
let mut num_indefinite_exclusive = 0;
168168

169169
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
170+
// FIXME: `needless_range_loop` false positive
171+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
172+
#[expect(clippy::needless_range_loop)]
170173
for i in 0..bind_users.len() {
171174
// Reject impossible combinations that should be caught earlier
172175
match bind_users[i] {
@@ -610,33 +613,22 @@ where
610613

611614
// Calculate `TopologicalSortVertexInfo::num_predecessors`
612615
let mut num_vertices_remaining = 0;
613-
{
614-
let mut it_vertices = graph.vertices();
615-
while let Some(v) = it_vertices.next() {
616-
temp_vertex_info[&v] = TopologicalSortVertexInfo {
617-
num_predecessors: 0,
618-
};
619-
num_vertices_remaining += 1;
620-
}
616+
for v in graph.vertices() {
617+
temp_vertex_info[&v] = TopologicalSortVertexInfo {
618+
num_predecessors: 0,
619+
};
620+
num_vertices_remaining += 1;
621621
}
622-
{
623-
let mut it_vertices = graph.vertices();
624-
while let Some(v) = it_vertices.next() {
625-
let mut it_successors = graph.successors(&v);
626-
while let Some(successor) = it_successors.next() {
627-
temp_vertex_info[&successor].num_predecessors += 1;
628-
}
622+
for v in graph.vertices() {
623+
for successor in graph.successors(&v) {
624+
temp_vertex_info[&successor].num_predecessors += 1;
629625
}
630626
}
631627

632628
// Push predecessor-less vertices to `temp_ready_vertex_queue`
633-
{
634-
let mut it_vertices = graph.vertices();
635-
while let Some(v) = it_vertices.next() {
636-
if temp_vertex_info[&v].num_predecessors == 0 {
637-
temp_ready_vertex_queue
638-
.heap_push(v, ReadyVertexQueueBinaryHeapCtx { vertex_ord_lt });
639-
}
629+
for v in graph.vertices() {
630+
if temp_vertex_info[&v].num_predecessors == 0 {
631+
temp_ready_vertex_queue.heap_push(v, ReadyVertexQueueBinaryHeapCtx { vertex_ord_lt });
640632
}
641633
}
642634

@@ -645,8 +637,7 @@ where
645637
{
646638
// Remove `v` from the graph, and push the now-predecessor-less
647639
// vertices to `temp_ready_vertex_queue`
648-
let mut it_successors = graph.successors(&v);
649-
while let Some(successor) = it_successors.next() {
640+
for successor in graph.successors(&v) {
650641
temp_vertex_info[&successor].num_predecessors -= 1;
651642
if temp_vertex_info[&successor].num_predecessors == 0 {
652643
temp_ready_vertex_queue

‎src/r3_core/src/kernel/interrupt.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,9 @@ pub(super) const fn panic_if_unmanaged_safety_is_violated<System: raw::KernelInt
443443
let is_line_assumed_managed = 'a: {
444444
let lines = System::RAW_MANAGED_INTERRUPT_LINES;
445445
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
446+
// FIXME: `needless_range_loop` false positive
447+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
448+
#[expect(clippy::needless_range_loop)]
446449
for i in 0..lines.len() {
447450
if lines[i] == handler.line {
448451
break 'a true;
@@ -696,6 +699,9 @@ pub const unsafe fn new_interrupt_handler_table<
696699
pub const fn num_required_interrupt_line_slots(handlers: &[CfgInterruptHandler]) -> usize {
697700
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
698701
let mut out = 0;
702+
// FIXME: `needless_range_loop` false positive
703+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
704+
#[expect(clippy::needless_range_loop)]
699705
for i in 0..handlers.len() {
700706
if handlers[i].line + 1 > out {
701707
out = handlers[i].line + 1;

‎src/r3_core/src/kernel/raw.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ impl QueueOrder {
270270

271271
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
272272
let values = System::RAW_SUPPORTED_QUEUE_ORDERS;
273+
// FIXME: `needless_range_loop` false positive
274+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
275+
#[expect(clippy::needless_range_loop)]
273276
for i in 0..values.len() {
274277
// `#[derive(PartialEq)]` doesn't derive `const PartialEq`
275278
// [ref:derive_const_partial_eq]
@@ -537,6 +540,9 @@ impl MutexProtocol {
537540

538541
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
539542
let values = System::RAW_SUPPORTED_MUTEX_PROTOCOLS;
543+
// FIXME: `needless_range_loop` false positive
544+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
545+
#[expect(clippy::needless_range_loop)]
540546
for i in 0..values.len() {
541547
// `#[derive(PartialEq)]` doesn't derive `const PartialEq`
542548
// [ref:derive_const_partial_eq]

‎src/r3_core/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#![feature(set_ptr_value)] // `<*const T>::set_ptr_value`
4040
#![feature(slice_ptr_len)]
4141
#![feature(const_option)]
42+
#![feature(lint_reasons)]
4243
#![feature(cell_update)]
4344
#![feature(const_deref)]
4445
#![feature(const_heap)]

‎src/r3_core/src/utils/init.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ impl<T: Init, const LEN: usize> Init for [T; LEN] {
3939
let mut array = mem::MaybeUninit::uninit_array();
4040

4141
// `[T]::iter` is unusable in `const fn` [ref:const_slice_iter]
42+
// FIXME: `needless_range_loop` false positive
43+
// <https://github.com/rust-lang/rust-clippy/issues/10524>
44+
#[expect(clippy::needless_range_loop)]
4245
for i in 0..LEN {
4346
array[i] = mem::MaybeUninit::new(T::INIT);
4447
}

‎src/r3_kernel/src/event_group.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ impl<Traits: KernelTraits> System<Traits> {
2828
unsafe fn event_group_cb(
2929
this: EventGroupId,
3030
) -> Result<&'static EventGroupCb<Traits>, NoAccessError> {
31-
Traits::get_event_group_cb(this.get() - 1)
32-
.ok_or_else(|| unsafe { crate::bad_id::<Traits>() })
31+
Traits::get_event_group_cb(this.get() - 1).ok_or_else(|| unsafe { crate::bad_id() })
3332
}
3433
}
3534

0 commit comments

Comments
 (0)