Skip to content

Commit

Permalink
more work
Browse files Browse the repository at this point in the history
  • Loading branch information
QuantumExplorer committed Jul 6, 2024
1 parent e3a477d commit 89607fe
Show file tree
Hide file tree
Showing 10 changed files with 294 additions and 211 deletions.
6 changes: 5 additions & 1 deletion grovedb/src/element/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,11 @@ impl fmt::Display for Element {
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 179 in grovedb/src/element/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/element/mod.rs:179:21 | 179 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 181 in grovedb/src/element/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/element/mod.rs:181:78 | 181 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}

impl Element {
Expand Down
6 changes: 5 additions & 1 deletion grovedb/src/element/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,11 @@ where
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 251 in grovedb/src/element/query.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/element/query.rs:251:21 | 251 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 253 in grovedb/src/element/query.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/element/query.rs:253:78 | 253 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}

impl Element {
Expand Down
6 changes: 5 additions & 1 deletion grovedb/src/operations/proof/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,11 @@ fn element_hex_to_ascii(hex_value: &[u8]) -> String {
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 176 in grovedb/src/operations/proof/generate.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/operations/proof/generate.rs:176:21 | 176 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 178 in grovedb/src/operations/proof/generate.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/operations/proof/generate.rs:178:78 | 178 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}

impl GroveDb {
Expand Down
6 changes: 5 additions & 1 deletion grovedb/src/operations/proof/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ fn element_hex_to_ascii(hex_value: &[u8]) -> String {
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 156 in grovedb/src/operations/proof/util.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/operations/proof/util.rs:156:21 | 156 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 158 in grovedb/src/operations/proof/util.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/operations/proof/util.rs:158:78 | 158 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}

impl ProvedPathKeyValue {
Expand Down
6 changes: 5 additions & 1 deletion grovedb/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@ impl fmt::Display for PathQuery {
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 53 in grovedb/src/query/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/query/mod.rs:53:21 | 53 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 55 in grovedb/src/query/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/query/mod.rs:55:78 | 55 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}

#[cfg(any(feature = "full", feature = "verify"))]
Expand Down
6 changes: 5 additions & 1 deletion grovedb/src/query_result_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ impl BTreeMapLevelResult {
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 114 in grovedb/src/query_result_type.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/query_result_type.rs:114:21 | 114 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 116 in grovedb/src/query_result_type.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> grovedb/src/query_result_type.rs:116:78 | 116 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}

impl BTreeMapLevelResult {
Expand Down
6 changes: 5 additions & 1 deletion merk/src/proofs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,5 +125,9 @@ impl fmt::Display for Node {
}

fn hex_to_ascii(hex_value: &[u8]) -> String {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(hex_value))
if hex_value.len() == 1 && hex_value[0] < b"0"[0] {
hex::encode(&hex_value)

Check warning on line 129 in merk/src/proofs/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> merk/src/proofs/mod.rs:129:21 | 129 | hex::encode(&hex_value) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
} else {
String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value))

Check warning on line 131 in merk/src/proofs/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

the borrowed expression implements the required traits

warning: the borrowed expression implements the required traits --> merk/src/proofs/mod.rs:131:78 | 131 | String::from_utf8(hex_value.to_vec()).unwrap_or_else(|_| hex::encode(&hex_value)) | ^^^^^^^^^^ help: change this to: `hex_value` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrows_for_generic_args
}
}
Loading

0 comments on commit 89607fe

Please sign in to comment.