mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 17:33:23 +00:00
Fix lint errors
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
82a2c4cdec
commit
cbb4b4e631
@ -146,7 +146,7 @@ impl ConfigManager<VirtioBlockConfig> {
|
||||
let cap_high = self
|
||||
.read_once::<u32>(offset_of!(VirtioBlockConfig, capacity) + 4)
|
||||
.unwrap() as u64;
|
||||
blk_config.capacity = cap_high << 32 | cap_low;
|
||||
blk_config.capacity = (cap_high << 32) | cap_low;
|
||||
blk_config.size_max = self
|
||||
.read_once::<u32>(offset_of!(VirtioBlockConfig, size_max))
|
||||
.unwrap();
|
||||
@ -193,7 +193,7 @@ impl ConfigManager<VirtioBlockConfig> {
|
||||
.read_once::<u32>(offset_of!(VirtioBlockConfig, capacity) + 4)
|
||||
.unwrap() as usize;
|
||||
|
||||
cap_high << 32 | cap_low
|
||||
(cap_high << 32) | cap_low
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ impl EventTable {
|
||||
let segment = FrameAllocOptions::new().alloc_segment(1).unwrap();
|
||||
|
||||
let default_event = VirtioInputEvent::default();
|
||||
let iter = iter::repeat(&default_event).take(EVENT_SIZE);
|
||||
let iter = iter::repeat_n(&default_event, EVENT_SIZE);
|
||||
let nr_written = segment.write_vals(0, iter, 0).unwrap();
|
||||
assert_eq!(nr_written, EVENT_SIZE);
|
||||
|
||||
|
@ -53,10 +53,10 @@ impl SocketDevice {
|
||||
let guest_cid = field_ptr!(&virtio_vsock_config, VirtioVsockConfig, guest_cid_low)
|
||||
.read_once()
|
||||
.unwrap() as u64
|
||||
| (field_ptr!(&virtio_vsock_config, VirtioVsockConfig, guest_cid_high)
|
||||
| ((field_ptr!(&virtio_vsock_config, VirtioVsockConfig, guest_cid_high)
|
||||
.read_once()
|
||||
.unwrap() as u64)
|
||||
<< 32;
|
||||
<< 32);
|
||||
|
||||
let mut recv_queue = VirtQueue::new(QUEUE_RECV, QUEUE_SIZE, transport.as_mut())
|
||||
.expect("creating recv queue fails");
|
||||
|
@ -225,7 +225,7 @@ impl VirtioTransport for VirtioMmioTransport {
|
||||
let device_feature_high = field_ptr!(&self.layout, VirtioMmioLayout, device_features)
|
||||
.read_once()
|
||||
.unwrap() as u64;
|
||||
device_feature_high << 32 | device_feature_low as u64
|
||||
(device_feature_high << 32) | device_feature_low as u64
|
||||
}
|
||||
|
||||
fn write_driver_features(&mut self, features: u64) -> Result<(), VirtioTransportError> {
|
||||
|
@ -163,7 +163,7 @@ impl VirtioTransport for VirtioPciModernTransport {
|
||||
let device_feature_high = field_ptr!(&self.common_cfg, VirtioPciCommonCfg, device_features)
|
||||
.read_once()
|
||||
.unwrap() as u64;
|
||||
device_feature_high << 32 | device_feature_low as u64
|
||||
(device_feature_high << 32) | device_feature_low as u64
|
||||
}
|
||||
|
||||
fn write_driver_features(&mut self, features: u64) -> Result<(), VirtioTransportError> {
|
||||
|
@ -70,8 +70,8 @@ impl Config {
|
||||
|
||||
/// ensure the config to be valid. We will check three things.
|
||||
/// 1. The component ident and library name(The last segment of component path) cannot be duplicate.
|
||||
/// 2. The controlled type in whilelist should be in one of defined components.
|
||||
/// 3. The components in whilelist should be defined.
|
||||
/// 2. The controlled type in whitelist should be in one of defined components.
|
||||
/// 3. The components in whitelist should be defined.
|
||||
pub fn check_config(&self) {
|
||||
let mut component_idents = HashSet::new();
|
||||
let mut lib_names = HashSet::new();
|
||||
@ -89,14 +89,14 @@ impl Config {
|
||||
lib_names.insert(lib_name);
|
||||
}
|
||||
|
||||
for (type_, whilelist) in &self.whitelists {
|
||||
for (type_, whitelist) in &self.whitelists {
|
||||
// check 2
|
||||
let component_ident = type_.iter().nth(0).unwrap();
|
||||
if !component_idents.contains(component_ident) {
|
||||
panic!("The controlled type is not in any component.");
|
||||
}
|
||||
// check 3
|
||||
for (component_name, _) in whilelist.iter() {
|
||||
for (component_name, _) in whitelist.iter() {
|
||||
if !component_idents.contains(component_name) {
|
||||
panic!("The component in whitelist is not defined");
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ use crate::{
|
||||
|
||||
const BUFFER_CAPACITY: usize = 4096;
|
||||
|
||||
/// Pesudo terminal master.
|
||||
/// Pseudo terminal master.
|
||||
/// Internally, it has two buffers.
|
||||
/// One is inside ldisc, which is written by master and read by slave,
|
||||
/// the other is a ring buffer, which is written by slave and read by master.
|
||||
|
@ -1067,8 +1067,8 @@ impl ExfatInode {
|
||||
}
|
||||
}
|
||||
|
||||
struct EmptyVistor;
|
||||
impl DirentVisitor for EmptyVistor {
|
||||
struct EmptyVisitor;
|
||||
impl DirentVisitor for EmptyVisitor {
|
||||
fn visit(&mut self, name: &str, ino: u64, type_: InodeType, offset: usize) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
@ -1458,7 +1458,7 @@ impl Inode for ExfatInode {
|
||||
return Ok(0);
|
||||
}
|
||||
|
||||
let mut empty_visitor = EmptyVistor;
|
||||
let mut empty_visitor = EmptyVisitor;
|
||||
|
||||
let dir_read = {
|
||||
let fs = inner.fs();
|
||||
|
@ -182,7 +182,7 @@ impl Clone for RangeLockItem {
|
||||
/// Rule of ordering:
|
||||
/// Locks are sorted by owner process, then by the starting offset.
|
||||
///
|
||||
/// Rule of mergeing:
|
||||
/// Rule of merging:
|
||||
/// Adjacent and overlapping locks with same owner and type will be merged.
|
||||
///
|
||||
/// Rule of updating:
|
||||
|
Reference in New Issue
Block a user