mirror of
https://github.com/encounter/decomp-toolkit.git
synced 2025-06-23 06:53:33 +00:00
clippy fixes
This commit is contained in:
parent
a064ddfd68
commit
ddd9dbb0ba
@ -360,7 +360,7 @@ fn blend_fg_color(fg: Color, bg: Color) -> Color {
|
|||||||
|
|
||||||
impl Write for HighlightWriter<'_> {
|
impl Write for HighlightWriter<'_> {
|
||||||
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
|
||||||
let str = from_utf8(buf).map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
|
let str = from_utf8(buf).map_err(std::io::Error::other)?;
|
||||||
for s in str.split_inclusive('\n') {
|
for s in str.split_inclusive('\n') {
|
||||||
self.line.push_str(s);
|
self.line.push_str(s);
|
||||||
if self.line.ends_with('\n') {
|
if self.line.ends_with('\n') {
|
||||||
@ -377,7 +377,7 @@ impl Write for HighlightWriter<'_> {
|
|||||||
let ops = self
|
let ops = self
|
||||||
.parse_state
|
.parse_state
|
||||||
.parse_line(&self.line, &self.syntax_set)
|
.parse_line(&self.line, &self.syntax_set)
|
||||||
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?;
|
.map_err(std::io::Error::other)?;
|
||||||
let iter = HighlightIterator::new(
|
let iter = HighlightIterator::new(
|
||||||
&mut self.highlight_state,
|
&mut self.highlight_state,
|
||||||
&ops[..],
|
&ops[..],
|
||||||
|
@ -50,7 +50,7 @@ const MAX_DATA_SECTIONS: usize = 11;
|
|||||||
pub fn run(args: Args) -> Result<()> {
|
pub fn run(args: Args) -> Result<()> {
|
||||||
let mut file = open_file(&args.elf_file, true)?;
|
let mut file = open_file(&args.elf_file, true)?;
|
||||||
let data = file.map()?;
|
let data = file.map()?;
|
||||||
if data.len() >= 4 && &data[0..4] == ALF_MAGIC {
|
if data.len() >= 4 && data[0..4] == ALF_MAGIC {
|
||||||
return convert_alf(args, data);
|
return convert_alf(args, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,8 +204,7 @@ fn make_rso(
|
|||||||
let mut rso_sections: Vec<RsoSectionHeader> =
|
let mut rso_sections: Vec<RsoSectionHeader> =
|
||||||
vec![RsoSectionHeader::default() /* ELF null section */];
|
vec![RsoSectionHeader::default() /* ELF null section */];
|
||||||
for section in file.sections() {
|
for section in file.sections() {
|
||||||
let is_valid_section =
|
let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n));
|
||||||
section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n));
|
|
||||||
let section_size = section.size();
|
let section_size = section.size();
|
||||||
|
|
||||||
if !is_valid_section || section_size == 0 {
|
if !is_valid_section || section_size == 0 {
|
||||||
@ -321,8 +320,7 @@ fn make_rso(
|
|||||||
let mut exported_relocations: Vec<RsoRelocation> = vec![];
|
let mut exported_relocations: Vec<RsoRelocation> = vec![];
|
||||||
|
|
||||||
for section in file.sections() {
|
for section in file.sections() {
|
||||||
let is_valid_section =
|
let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n));
|
||||||
section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n));
|
|
||||||
if !is_valid_section {
|
if !is_valid_section {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user