Skip to content

Commit 5ad6e1e

Browse files
author
szy
committed
fix fmt
1 parent 2d076ff commit 5ad6e1e

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

src/vmm/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ pub mod config {
5656
let path = entry.path();
5757
// Check if the file has a .toml extension
5858
let path_str = path.as_str();
59-
if path_str.ends_with(".toml") && let Ok(content) = fs::read_to_string(path_str) {
59+
if path_str.ends_with(".toml")
60+
&& let Ok(content) = fs::read_to_string(path_str)
61+
{
6062
configs.push(content);
6163
}
6264
}

src/vmm/fdt/create.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,7 @@ fn handle_node_level_change(
206206
}
207207

208208
/// Determine if node is an ancestor of passthrough device
209-
fn is_ancestor_of_passthrough_device(
210-
node_path: &str,
211-
passthrough_device_names: &[String],
212-
) -> bool {
209+
fn is_ancestor_of_passthrough_device(node_path: &str, passthrough_device_names: &[String]) -> bool {
213210
for passthrough_path in passthrough_device_names {
214211
// Check if the current node is an ancestor of a passthrough device
215212
if passthrough_path.starts_with(node_path) && passthrough_path.len() > node_path.len() {
@@ -230,7 +227,8 @@ fn need_cpu_node(phys_cpu_ids: &[usize], node: &Node, node_path: &str) -> bool {
230227
if !node_path.starts_with("/cpus/cpu@") {
231228
should_include_node = true;
232229
} else if let Some(mut cpu_reg) = node.reg()
233-
&& let Some(reg_entry) = cpu_reg.next() {
230+
&& let Some(reg_entry) = cpu_reg.next()
231+
{
234232
let cpu_address = reg_entry.address as usize;
235233
debug!(
236234
"Checking CPU node {} with address 0x{:x}",

src/vmm/fdt/device.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,8 @@ pub fn build_optimized_node_cache<'a>(fdt: &'a Fdt) -> BTreeMap<String, Vec<Node
215215
for (index, node) in all_nodes.iter().enumerate() {
216216
let node_path = build_node_path(&all_nodes, index);
217217
if let Some(existing_nodes) = node_cache.get(&node_path)
218-
&& !existing_nodes.is_empty() {
218+
&& !existing_nodes.is_empty()
219+
{
219220
error!(
220221
"Duplicate node path found: {} for node '{}' at level {}, existing node: '{}'",
221222
node_path,
@@ -229,10 +230,7 @@ pub fn build_optimized_node_cache<'a>(fdt: &'a Fdt) -> BTreeMap<String, Vec<Node
229230
"Adding node to cache: {} (level: {}, index: {})",
230231
node_path, node.level, index
231232
);
232-
node_cache
233-
.entry(node_path)
234-
.or_default()
235-
.push(node.clone());
233+
node_cache.entry(node_path).or_default().push(node.clone());
236234
}
237235

238236
debug!(

src/vmm/fdt/parser.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,8 @@ pub fn parse_passthrough_devices_address(vm_cfg: &mut AxVMConfig, dtb: &[u8]) {
236236
if node_name.starts_with("pcie@") || node_name.contains("pci") {
237237
// Process PCIe device's ranges property
238238
if let Some(pci) = node.clone().into_pci()
239-
&& let Ok(ranges) = pci.ranges() {
239+
&& let Ok(ranges) = pci.ranges()
240+
{
240241
for (index, range) in ranges.enumerate() {
241242
add_pci_ranges_config(vm_cfg, &node_name, &range, index);
242243
}

0 commit comments

Comments
 (0)