mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-24 18:03:25 +00:00
Fix clippy and compiler warings
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
20a90426a0
commit
9ca64c281e
@ -39,8 +39,7 @@ impl phy::RxToken for RxToken {
|
||||
F: FnOnce(&mut [u8]) -> R,
|
||||
{
|
||||
let packet_but = self.0.packet_mut();
|
||||
let res = f(packet_but);
|
||||
res
|
||||
f(packet_but)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ pub fn handle_recv_irq(name: &String) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn all_devices() -> Vec<(String, Arc<SpinLock<Box<dyn NetworkDevice>>>)> {
|
||||
pub fn all_devices() -> Vec<(String, NetworkDeviceRef)> {
|
||||
let lock = COMPONENT.get().unwrap().devices.lock();
|
||||
let mut vec = Vec::new();
|
||||
for (name, (_, device)) in lock.iter() {
|
||||
@ -112,17 +112,12 @@ fn init() -> Result<(), ComponentInitError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
type NetDeviceIrqHandlerListRef = Arc<SpinLock<Vec<Arc<dyn NetDeviceIrqHandler>>>>;
|
||||
type NetworkDeviceRef = Arc<SpinLock<Box<dyn NetworkDevice>>>;
|
||||
|
||||
struct Component {
|
||||
/// Device list, the key is device name, value is (callbacks, device);
|
||||
devices: SpinLock<
|
||||
BTreeMap<
|
||||
String,
|
||||
(
|
||||
Arc<SpinLock<Vec<Arc<dyn NetDeviceIrqHandler>>>>,
|
||||
Arc<SpinLock<Box<dyn NetworkDevice>>>,
|
||||
),
|
||||
>,
|
||||
>,
|
||||
devices: SpinLock<BTreeMap<String, (NetDeviceIrqHandlerListRef, NetworkDeviceRef)>>,
|
||||
}
|
||||
|
||||
impl Component {
|
||||
|
Reference in New Issue
Block a user