summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsitkevij <sitkevij@gmail.com>2020-04-14 21:50:17 -0700
committersitkevij <sitkevij@gmail.com>2020-04-14 21:50:17 -0700
commitf0653e932eab3093d2c2087a298bdb1a03c6d34a (patch)
treee65cc840b7b1b2c8ae4d70f7b7e88aaade8a6858
parent66f0a6dab366c5d8f143fcaf3dcd8ec9edde0479 (diff)
resolve warnings and set edition
- trait objects without an explicit are deprecated - variable does not need to be mutable
-rw-r--r--Cargo.lock4
-rw-r--r--Cargo.toml3
-rw-r--r--src/lib.rs12
3 files changed, 11 insertions, 8 deletions
diff --git a/Cargo.lock b/Cargo.lock
index e829e86..6574600 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1,3 +1,5 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
[[package]]
name = "ansi_term"
version = "0.11.0"
@@ -37,7 +39,7 @@ dependencies = [
[[package]]
name = "hx"
-version = "0.2.1"
+version = "0.2.2"
dependencies = [
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/Cargo.toml b/Cargo.toml
index 7342a13..f7410df 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -7,7 +7,8 @@ repository = "https://github.com/sitkevij/hex"
keywords = ["hexdump", "hexadecimal", "tools", "ascii", "hex"]
license = "MIT"
name = "hx"
-version = "0.2.1"
+version = "0.2.2"
+edition = "2018"
# see https://doc.rust-lang.org/cargo/reference/manifest.html
[badges]
diff --git a/src/lib.rs b/src/lib.rs
index c3798c6..5ea9b50 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -211,7 +211,7 @@ pub fn func_out(len: u64, places: usize) {
/// # Arguments
///
/// * `matches` - Argument matches from command line.
-pub fn run(matches: ArgMatches) -> Result<(), Box<::std::error::Error>> {
+pub fn run(matches: ArgMatches) -> Result<(), Box<dyn ::std::error::Error>> {
let mut column_width: u64 = 10;
if let Some(len) = matches.value_of("func") {
let mut p: usize = 4;
@@ -266,8 +266,8 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<::std::error::Error>> {
// array output mode is mutually exclusive
if let Some(array) = matches.value_of("array") {
- let mut array_format = array;
- let mut page = buf_to_array(&mut buf, buf_len, column_width).unwrap();
+ let array_format = array;
+ let page = buf_to_array(&mut buf, buf_len, column_width).unwrap();
match array_format {
"r" => println!("let ARRAY: [u8; {}] = [", page.bytes),
"c" => println!("unsigned char ARRAY[{}] = {{", page.bytes),
@@ -304,7 +304,7 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<::std::error::Error>> {
let mut ascii_line: Line = Line::new();
let mut offset_counter: u64 = 0x0;
let mut byte_column: u64 = 0x0;
- let mut page = buf_to_array(&mut buf, buf_len, column_width).unwrap();
+ let page = buf_to_array(&mut buf, buf_len, column_width).unwrap();
for line in page.body.iter() {
print_offset(offset_counter);
@@ -346,10 +346,10 @@ pub fn run(matches: ArgMatches) -> Result<(), Box<::std::error::Error>> {
/// * `buf_len` - Buffer length.
/// * `column_width` - column width for output.
pub fn buf_to_array(
- buf: &mut Read,
+ buf: &mut dyn Read,
buf_len: u64,
column_width: u64,
-) -> Result<Page, Box<::std::error::Error>> {
+) -> Result<Page, Box<dyn ::std::error::Error>> {
let mut column_count: u64 = 0x0;
let max_array_size: u16 = <u16>::max_value(); // 2^16;
let mut page: Page = Page::new();