mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
cargo fmt
This commit is contained in:
1 parent
8363e3f37e
commit
7cc0b51537
1 file changed
+22
-23
+22
-23
@@ -110,21 +110,20 @@ impl BorderStyle {
|
|||||||
fn outer_sep(&self) -> char {
|
fn outer_sep(&self) -> char {
|
||||||
match self {
|
match self {
|
||||||
BorderStyle::Unicode => '│',
|
BorderStyle::Unicode => '│',
|
||||||
BorderStyle::Ascii => '|',
|
BorderStyle::Ascii => '|',
|
||||||
BorderStyle::None => ' ',
|
BorderStyle::None => ' ',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn inner_sep(&self) -> char {
|
fn inner_sep(&self) -> char {
|
||||||
match self {
|
match self {
|
||||||
BorderStyle::Unicode => '┊',
|
BorderStyle::Unicode => '┊',
|
||||||
BorderStyle::Ascii => '|',
|
BorderStyle::Ascii => '|',
|
||||||
BorderStyle::None => ' ',
|
BorderStyle::None => ' ',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct Printer<'a> {
|
struct Printer<'a> {
|
||||||
idx: usize,
|
idx: usize,
|
||||||
/// The raw bytes used as input for the current line.
|
/// The raw bytes used as input for the current line.
|
||||||
@@ -180,8 +179,13 @@ impl<'a> Printer<'a> {
|
|||||||
writeln!(
|
writeln!(
|
||||||
self.stdout,
|
self.stdout,
|
||||||
"{l}{h8}{c}{h25}{c}{h25}{c}{h8}{c}{h8}{r}",
|
"{l}{h8}{c}{h25}{c}{h25}{c}{h8}{c}{h8}{r}",
|
||||||
l=l, c=c, r=r, h8=h8, h25=h25
|
l = l,
|
||||||
).ok();
|
c = c,
|
||||||
|
r = r,
|
||||||
|
h8 = h8,
|
||||||
|
h25 = h25
|
||||||
|
)
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,8 +197,13 @@ impl<'a> Printer<'a> {
|
|||||||
writeln!(
|
writeln!(
|
||||||
self.stdout,
|
self.stdout,
|
||||||
"{l}{h8}{c}{h25}{c}{h25}{c}{h8}{c}{h8}{r}",
|
"{l}{h8}{c}{h25}{c}{h25}{c}{h8}{c}{h8}{r}",
|
||||||
l=l, c=c, r=r, h8=h8, h25=h25
|
l = l,
|
||||||
).ok();
|
c = c,
|
||||||
|
r = r,
|
||||||
|
h8 = h8,
|
||||||
|
h25 = h25
|
||||||
|
)
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,11 +230,7 @@ impl<'a> Printer<'a> {
|
|||||||
|
|
||||||
match self.idx % 16 {
|
match self.idx % 16 {
|
||||||
8 => {
|
8 => {
|
||||||
let _ = write!(
|
let _ = write!(&mut self.buffer_line, "{} ", self.border_style.inner_sep());
|
||||||
&mut self.buffer_line,
|
|
||||||
"{} ",
|
|
||||||
self.border_style.inner_sep()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
0 => {
|
0 => {
|
||||||
if !self.header_was_printed {
|
if !self.header_was_printed {
|
||||||
@@ -278,11 +283,7 @@ impl<'a> Printer<'a> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if idx == 8 {
|
if idx == 8 {
|
||||||
let _ = write!(
|
let _ = write!(&mut self.buffer_line, "{}", self.border_style.inner_sep());
|
||||||
&mut self.buffer_line,
|
|
||||||
"{}",
|
|
||||||
self.border_style.inner_sep()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
idx += 1;
|
idx += 1;
|
||||||
@@ -376,12 +377,10 @@ fn run() -> Result<(), Box<::std::error::Error>> {
|
|||||||
if let Some(length) = length_arg.and_then(|n| {
|
if let Some(length) = length_arg.and_then(|n| {
|
||||||
if n.starts_with("0x") {
|
if n.starts_with("0x") {
|
||||||
u64::from_str_radix(n.trim_start_matches("0x"), 16).ok()
|
u64::from_str_radix(n.trim_start_matches("0x"), 16).ok()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
n.parse::<u64>().ok()
|
n.parse::<u64>().ok()
|
||||||
}
|
}
|
||||||
})
|
}) {
|
||||||
{
|
|
||||||
reader = Box::new(reader.take(length));
|
reader = Box::new(reader.take(length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user