Skip to content

Commit a4fecee

Browse files
josephlrrbradford
authored andcommitted
rust-toolchain: Fix warnings on new toolchain
- &Trait -> &dyn Trait - Remove unneeded parens Signed-off-by: Joe Richey <joerichey@google.com>
1 parent ce4bbb0 commit a4fecee

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

src/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct UsedElem {
7070
#[cfg(not(test))]
7171
/// Device driver for virtio block over any transport
7272
pub struct VirtioBlockDevice<'a> {
73-
transport: &'a mut VirtioTransport,
73+
transport: &'a mut dyn VirtioTransport,
7474
state: RefCell<DriverState>,
7575
}
7676

@@ -131,7 +131,7 @@ enum RequestType {
131131

132132
#[cfg(not(test))]
133133
impl<'a> VirtioBlockDevice<'a> {
134-
pub fn new(transport: &'a mut VirtioTransport) -> VirtioBlockDevice<'a> {
134+
pub fn new(transport: &'a mut dyn VirtioTransport) -> VirtioBlockDevice<'a> {
135135
VirtioBlockDevice {
136136
transport,
137137
state: RefCell::new(DriverState::default()),

src/bzimage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct E820Entry {
5656
}
5757

5858
#[cfg(not(test))]
59-
pub fn load_initrd(f: &mut Read) -> Result<(), Error> {
59+
pub fn load_initrd(f: &mut dyn Read) -> Result<(), Error> {
6060
let mut zero_page = crate::mem::MemoryRegion::new(ZERO_PAGE_START as u64, 4096);
6161

6262
let mut max_load_address = u64::from(zero_page.read_u32(0x22c));
@@ -147,7 +147,7 @@ pub fn append_commandline(addition: &str) -> Result<(), Error> {
147147
}
148148

149149
#[cfg(not(test))]
150-
pub fn load_kernel(f: &mut Read) -> Result<(u64), Error> {
150+
pub fn load_kernel(f: &mut dyn Read) -> Result<u64, Error> {
151151
f.seek(0)?;
152152

153153
let mut buf: [u8; 1024] = [0; 1024];

src/fat.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ enum FatType {
9090
}
9191

9292
pub struct Filesystem<'a> {
93-
device: &'a SectorRead,
93+
device: &'a dyn SectorRead,
9494
start: u64,
9595
last: u64,
9696
bytes_per_sector: u32,
@@ -374,7 +374,7 @@ fn compare_name(name: &str, de: &DirectoryEntry) -> bool {
374374
}
375375

376376
impl<'a> Filesystem<'a> {
377-
pub fn new(device: &'a SectorRead, start: u64, last: u64) -> Filesystem {
377+
pub fn new(device: &'a dyn SectorRead, start: u64, last: u64) -> Filesystem {
378378
Filesystem {
379379
device,
380380
start,

src/loader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ fn default_entry_path(fs: &fat::Filesystem) -> Result<[u8; 260], fat::Error> {
126126
}
127127

128128
#[cfg(not(test))]
129-
pub fn load_default_entry(fs: &fat::Filesystem) -> Result<(u64), Error> {
129+
pub fn load_default_entry(fs: &fat::Filesystem) -> Result<u64, Error> {
130130
let default_entry_path = default_entry_path(&fs)?;
131131
let default_entry_path = ascii_strip(&default_entry_path);
132132

src/part.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub enum Error {
6868
NoEFIPartition,
6969
}
7070

71-
pub fn get_partitions(r: &SectorRead, parts_out: &mut [PartitionEntry]) -> Result<u32, Error> {
71+
pub fn get_partitions(r: &dyn SectorRead, parts_out: &mut [PartitionEntry]) -> Result<u32, Error> {
7272
let mut data: [u8; 512] = [0; 512];
7373
match r.read(1, &mut data) {
7474
Ok(_) => {}
@@ -123,7 +123,7 @@ pub fn get_partitions(r: &SectorRead, parts_out: &mut [PartitionEntry]) -> Resul
123123
}
124124

125125
/// Find EFI partition
126-
pub fn find_efi_partition(r: &SectorRead) -> Result<(u64, u64), Error> {
126+
pub fn find_efi_partition(r: &dyn SectorRead) -> Result<(u64, u64), Error> {
127127
// Assume no more than 16 partitions on the disk
128128
let mut parts: [PartitionEntry; 16] = unsafe { core::mem::zeroed() };
129129

src/pe.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use crate::mem::MemoryRegion;
1616

1717
pub struct Loader<'a> {
18-
file: &'a mut crate::fat::Read,
18+
file: &'a mut dyn crate::fat::Read,
1919
num_sections: u16,
2020
image_base: u64,
2121
image_size: u32,
@@ -38,7 +38,7 @@ struct Section {
3838
}
3939

4040
impl<'a> Loader<'a> {
41-
pub fn new(file: &'a mut crate::fat::Read) -> Loader {
41+
pub fn new(file: &'a mut dyn crate::fat::Read) -> Loader {
4242
Loader {
4343
file,
4444
num_sections: 0,

0 commit comments

Comments
 (0)