mirror of
https://github.com/encounter/decomp-toolkit.git
synced 2025-06-22 14:33:28 +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<'_> {
|
||||
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') {
|
||||
self.line.push_str(s);
|
||||
if self.line.ends_with('\n') {
|
||||
@ -377,7 +377,7 @@ impl Write for HighlightWriter<'_> {
|
||||
let ops = self
|
||||
.parse_state
|
||||
.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(
|
||||
&mut self.highlight_state,
|
||||
&ops[..],
|
||||
|
@ -50,7 +50,7 @@ const MAX_DATA_SECTIONS: usize = 11;
|
||||
pub fn run(args: Args) -> Result<()> {
|
||||
let mut file = open_file(&args.elf_file, true)?;
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -204,8 +204,7 @@ fn make_rso(
|
||||
let mut rso_sections: Vec<RsoSectionHeader> =
|
||||
vec![RsoSectionHeader::default() /* ELF null section */];
|
||||
for section in file.sections() {
|
||||
let is_valid_section =
|
||||
section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n));
|
||||
let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n));
|
||||
let section_size = section.size();
|
||||
|
||||
if !is_valid_section || section_size == 0 {
|
||||
@ -321,8 +320,7 @@ fn make_rso(
|
||||
let mut exported_relocations: Vec<RsoRelocation> = vec![];
|
||||
|
||||
for section in file.sections() {
|
||||
let is_valid_section =
|
||||
section.name().is_ok_and(|n| RSO_SECTION_NAMES.iter().any(|&s| s == n));
|
||||
let is_valid_section = section.name().is_ok_and(|n| RSO_SECTION_NAMES.contains(&n));
|
||||
if !is_valid_section {
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user