diff --git a/slinky/src/linker_writer.rs b/slinky/src/linker_writer.rs index f07a818..989d017 100644 --- a/slinky/src/linker_writer.rs +++ b/slinky/src/linker_writer.rs @@ -27,7 +27,7 @@ impl<'a> LinkerWriter<'a> { linker_symbols: HashSet::new(), indent_level: 0, buffer: Vec::new(), - options: options, + options, } } @@ -111,7 +111,7 @@ impl<'a> LinkerWriter<'a> { let mut f = File::create(path)?; for line in &self.buffer { - write!(f, "{}\n", line)?; + writeln!(f, "{}", line)?; } Ok(()) @@ -121,7 +121,7 @@ impl<'a> LinkerWriter<'a> { // internal functions impl LinkerWriter<'_> { fn writeln(&mut self, line: &str) { - if line.len() == 0 { + if line.is_empty() { self.buffer.push("".to_string()); } else { let mut temp = String::new(); @@ -159,7 +159,7 @@ impl LinkerWriter<'_> { let mut line = format!("{}{}", emitted_segment_name, name_suffix); if noload { - line += &format!(" (NOLOAD) :"); + line += " (NOLOAD) :"; } else { if let Some(fixed_vram) = segment.fixed_vram { line += &format!(" 0x{:08X}", fixed_vram); diff --git a/slinky/src/paths_configs.rs b/slinky/src/paths_configs.rs index 9a19b79..db81804 100644 --- a/slinky/src/paths_configs.rs +++ b/slinky/src/paths_configs.rs @@ -6,12 +6,8 @@ use std::path::PathBuf; #[derive(Deserialize, PartialEq, Debug)] #[serde(default)] +#[derive(Default)] pub struct PathsConfigs { pub base_path: Option, } -impl Default for PathsConfigs { - fn default() -> Self { - Self { base_path: None } - } -} diff --git a/slinky/src/segment_symbols_style.rs b/slinky/src/segment_symbols_style.rs index 58fd81f..a46268b 100644 --- a/slinky/src/segment_symbols_style.rs +++ b/slinky/src/segment_symbols_style.rs @@ -41,7 +41,7 @@ impl SegmentSymbolsStyle { fn convert_section_name_to_linker_format(&self, section_type: &str) -> String { match self { - SegmentSymbolsStyle::Splat => section_type.replace(".", "_"), + SegmentSymbolsStyle::Splat => section_type.replace('.', "_"), SegmentSymbolsStyle::Makerom => { if section_type == ".rodata" { "RoData".to_string() @@ -70,7 +70,7 @@ impl SegmentSymbolsStyle { } pub fn segment_section_start(&self, seg_name: &str, section_type: &str) -> String { - let sec = self.convert_section_name_to_linker_format(§ion_type); + let sec = self.convert_section_name_to_linker_format(section_type); match self { SegmentSymbolsStyle::Splat => format!("{}{}_START", seg_name, sec), @@ -79,7 +79,7 @@ impl SegmentSymbolsStyle { } pub fn segment_section_end(&self, seg_name: &str, section_type: &str) -> String { - let sec = self.convert_section_name_to_linker_format(§ion_type); + let sec = self.convert_section_name_to_linker_format(section_type); match self { SegmentSymbolsStyle::Splat => format!("{}{}_END", seg_name, sec), @@ -88,7 +88,7 @@ impl SegmentSymbolsStyle { } pub fn segment_section_size(&self, seg_name: &str, section_type: &str) -> String { - let sec = self.convert_section_name_to_linker_format(§ion_type); + let sec = self.convert_section_name_to_linker_format(section_type); match self { SegmentSymbolsStyle::Splat => format!("{}{}_SIZE", seg_name, sec),