Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
AngheloAlf committed Feb 22, 2024
1 parent 71cc1e6 commit 2b97ff6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
8 changes: 4 additions & 4 deletions slinky/src/linker_writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<'a> LinkerWriter<'a> {
linker_symbols: HashSet::new(),
indent_level: 0,
buffer: Vec::new(),
options: options,
options,
}
}

Expand Down Expand Up @@ -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(())
Expand All @@ -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();
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions slinky/src/paths_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ use std::path::PathBuf;

#[derive(Deserialize, PartialEq, Debug)]
#[serde(default)]
#[derive(Default)]
pub struct PathsConfigs {
pub base_path: Option<PathBuf>,
}

impl Default for PathsConfigs {
fn default() -> Self {
Self { base_path: None }
}
}
8 changes: 4 additions & 4 deletions slinky/src/segment_symbols_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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(&section_type);
let sec = self.convert_section_name_to_linker_format(section_type);

match self {
SegmentSymbolsStyle::Splat => format!("{}{}_START", seg_name, sec),
Expand All @@ -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(&section_type);
let sec = self.convert_section_name_to_linker_format(section_type);

match self {
SegmentSymbolsStyle::Splat => format!("{}{}_END", seg_name, sec),
Expand All @@ -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(&section_type);
let sec = self.convert_section_name_to_linker_format(section_type);

match self {
SegmentSymbolsStyle::Splat => format!("{}{}_SIZE", seg_name, sec),
Expand Down

0 comments on commit 2b97ff6

Please sign in to comment.