Skip to content

Commit 25c33e7

Browse files
committed
Fix clippy/lint nits for rust 1.77.0
1 parent fdf0585 commit 25c33e7

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

bin/propolis-server/src/lib/vm/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ impl VmController {
865865
&self,
866866
name: &String,
867867
) -> Option<Arc<dyn propolis::common::Lifecycle>> {
868-
self.vm_objects.devices.get(name).map(Arc::clone)
868+
self.vm_objects.devices.get(name).cloned()
869869
}
870870
}
871871

bin/propolis-standalone/src/main.rs

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ impl From<propolis::exits::Suspend> for InstEvent {
7878
}
7979

8080
#[derive(Clone, Debug)]
81+
// Silence the lint about detail fields being unused, since rustc ignores the
82+
// derived Debug impl which does read those bits.
83+
#[allow(dead_code)]
8184
enum EventCtx {
8285
Vcpu(i32),
8386
Pin(String),

lib/propolis/src/hw/nvme/mod.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -285,21 +285,15 @@ impl NvmeCtrl {
285285
if (cqid as usize) >= MAX_NUM_QUEUES {
286286
return Err(NvmeError::InvalidCompQueue(cqid));
287287
}
288-
self.cqs[cqid as usize]
289-
.as_ref()
290-
.map(Arc::clone)
291-
.ok_or(NvmeError::InvalidCompQueue(cqid))
288+
self.cqs[cqid as usize].clone().ok_or(NvmeError::InvalidCompQueue(cqid))
292289
}
293290

294291
/// Returns a reference to the [`SubQueue`] which corresponds to the given submission queue id (`cqid`).
295292
fn get_sq(&self, sqid: QueueId) -> Result<Arc<SubQueue>, NvmeError> {
296293
if (sqid as usize) >= MAX_NUM_QUEUES {
297294
return Err(NvmeError::InvalidSubQueue(sqid));
298295
}
299-
self.sqs[sqid as usize]
300-
.as_ref()
301-
.map(Arc::clone)
302-
.ok_or(NvmeError::InvalidSubQueue(sqid))
296+
self.sqs[sqid as usize].clone().ok_or(NvmeError::InvalidSubQueue(sqid))
303297
}
304298

305299
/// Returns a reference to the Admin [`CompQueue`].

lib/propolis/src/hw/pci/bus.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ impl Inner {
162162
fn device_at(&self, location: BusLocation) -> Option<Arc<dyn Endpoint>> {
163163
let res = self.slots[location.dev.get() as usize].funcs
164164
[location.func.get() as usize]
165-
.as_ref()
166-
.map(Arc::clone);
165+
.clone();
167166
res
168167
}
169168
fn attach(

lib/propolis/src/vmm/mem.rs

+3
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,9 @@ unsafe impl Send for Mapping {}
344344
unsafe impl Sync for Mapping {}
345345

346346
#[derive(Debug)]
347+
// Backing resources (Mapping or SubMapping) must remain held, even though we do
348+
// not reference them directly as a field.
349+
#[allow(dead_code)]
347350
enum Backing<'a> {
348351
Base(Arc<Mapping>),
349352
Sub(&'a SubMapping<'a>),

0 commit comments

Comments
 (0)