diff --git a/tools/kicad_rs/src/classifier.rs b/tools/kicad_rs/src/classifier.rs index bdd6694..31f9d58 100644 --- a/tools/kicad_rs/src/classifier.rs +++ b/tools/kicad_rs/src/classifier.rs @@ -1,6 +1,6 @@ +use crate::error::DynamicResult; use crate::labels::LabelsMatch; use crate::requirements::Requirement; -use crate::error::DynamicResult; use crate::types::{Component, Schematic}; use serde::{Deserialize, Serialize}; use std::collections::HashSet; diff --git a/tools/kicad_rs/src/parser.rs b/tools/kicad_rs/src/parser.rs index 40b79ea..ca9f6d2 100644 --- a/tools/kicad_rs/src/parser.rs +++ b/tools/kicad_rs/src/parser.rs @@ -58,12 +58,13 @@ pub fn parse_meta(kicad_sch: &SchematicFile) -> DynamicResult { kicad_sch.content.description.comment3.as_str(), kicad_sch.content.description.comment4.as_str(), ] - .iter() - .flat_map(|c| c.filter_empty()) - .collect(); + .iter() + .flat_map(|c| c.filter_empty()) + .collect(); Ok(SchematicMeta { - file_name: kicad_sch.path + file_name: kicad_sch + .path .file_name() .map(|s| s.to_str()) .flatten() @@ -220,8 +221,8 @@ pub fn parse_components(kicad_sch: &SchematicFile) -> DynamicResult 0 || get_component_attr_mapped(&comp, "iccc_show", &m) - .or_empty_str() - .is_true_like() + .or_empty_str() + .is_true_like() { // Validate that required fields are set for (key, val) in &c.labels.to_map() { @@ -242,14 +243,13 @@ pub fn parse_components(kicad_sch: &SchematicFile) -> DynamicResult DynamicResult> { +pub fn parse_sub_schematics(kicad_sch: &SchematicFile) -> DynamicResult> { let mut sub_schematics = Vec::new(); // Recursively traverse and parse the sub-schematics for sub_sheet in &kicad_sch.content.sheets { - let p = kicad_sch.path + let p = kicad_sch + .path .parent() .unwrap_or(Path::new("")) .join(Path::new(&sub_sheet.filename));