Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
ethteck committed Sep 3, 2024
1 parent 01e2f8a commit a208805
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
4 changes: 2 additions & 2 deletions app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::{
use anyhow::Error;
use bdiff_hex_view::{CursorState, HexViewSelection, HexViewSelectionSide, HexViewSelectionState};
use eframe::{
egui::{self, Checkbox, Context, Style, ViewportCommand},
egui::{self, Checkbox, Style, ViewportCommand},
epaint::{Rounding, Shadow},
};
use egui_modal::Modal;
Expand Down Expand Up @@ -554,7 +554,7 @@ impl eframe::App for BdiffApp {
.collect::<Vec<String>>()
.join(" "),
HexViewSelectionSide::Ascii => {
String::from_utf8_lossy(&selected_bytes).to_string()
String::from_utf8_lossy(selected_bytes).to_string()
}
};
// convert selected_bytes to an ascii string
Expand Down
12 changes: 3 additions & 9 deletions app/src/string_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ impl StringViewer {
ui.add(egui::Label::new(egui::RichText::new("UTF-16").monospace()));
ui.text_edit_singleline(
&mut encoding
.decode_without_bom_handling_and_without_replacement(
&selected_bytes,
)
.decode_without_bom_handling_and_without_replacement(selected_bytes)
.unwrap_or_default()
.to_string(),
);
Expand All @@ -86,9 +84,7 @@ impl StringViewer {
ui.add(egui::Label::new(egui::RichText::new("EUC-JP").monospace()));
ui.text_edit_singleline(
&mut EUC_JP
.decode_without_bom_handling_and_without_replacement(
&selected_bytes,
)
.decode_without_bom_handling_and_without_replacement(selected_bytes)
.unwrap_or_default()
.to_string(),
);
Expand All @@ -101,9 +97,7 @@ impl StringViewer {
));
ui.text_edit_singleline(
&mut SHIFT_JIS
.decode_without_bom_handling_and_without_replacement(
&selected_bytes,
)
.decode_without_bom_handling_and_without_replacement(selected_bytes)
.unwrap_or_default()
.to_string(),
);
Expand Down
20 changes: 10 additions & 10 deletions hex_view/src/hex_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ impl HexView {
.font(font_id.clone())
.color({
if offset_leading_zeros {
Color32::from(self.style.offset_leading_zero_color.clone())
self.style.offset_leading_zero_color
} else {
Color32::from(self.style.offset_text_color.clone())
self.style.offset_text_color
}
}),
);
Expand Down Expand Up @@ -279,16 +279,16 @@ impl HexView {
// if diff_state.enabled
// && diff_state.is_diff_at(row_current_pos)
// {
// Color32::from(self.style.diff_color.clone())
// self.style.diff_color
// } else {
match byte {
Some(0) => Color32::from(self.style.hex_null_color.clone()),
_ => Color32::from(self.style.other_hex_color.clone()),
Some(0) => self.style.hex_null_color,
_ => self.style.other_hex_color,
}, // },
)
.background_color({
if self.selection.contains(row_current_pos) {
self.style.selection_color.clone()
self.style.selection_color
} else {
Color32::TRANSPARENT
}
Expand Down Expand Up @@ -340,13 +340,13 @@ impl HexView {
egui::RichText::new(ascii_char)
.font(font_id.clone())
.color(match byte {
Some(0) => Color32::from(self.style.ascii_null_color.clone()),
Some(32..=126) => Color32::from(self.style.ascii_color.clone()),
_ => Color32::from(self.style.other_ascii_color.clone()),
Some(0) => self.style.ascii_null_color,
Some(32..=126) => self.style.ascii_color,
_ => self.style.other_ascii_color,
})
.background_color({
if self.selection.contains(row_current_pos) {
self.style.selection_color.clone()
self.style.selection_color
} else {
Color32::TRANSPARENT
}
Expand Down

0 comments on commit a208805

Please sign in to comment.