Add various fixes to clippy lints

Thou shalt appease clippy
This commit is contained in:
Paul Hauner
2019-06-10 11:01:25 -04:00
parent a9284bec18
commit e550c0218f
37 changed files with 72 additions and 82 deletions

View File

@@ -8,14 +8,14 @@ pub use utils::*;
pub trait YamlDecode: Sized {
/// Decode an object from the test specification YAML.
fn yaml_decode(string: &String) -> Result<Self, Error>;
fn yaml_decode(string: &str) -> Result<Self, Error>;
}
/// Basic types can general be decoded with the `parse` fn if they implement `str::FromStr`.
macro_rules! impl_via_parse {
($ty: ty) => {
impl YamlDecode for $ty {
fn yaml_decode(string: &String) -> Result<Self, Error> {
fn yaml_decode(string: &str) -> Result<Self, Error> {
string
.parse::<Self>()
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))
@@ -34,7 +34,7 @@ impl_via_parse!(u64);
macro_rules! impl_via_from_dec_str {
($ty: ty) => {
impl YamlDecode for $ty {
fn yaml_decode(string: &String) -> Result<Self, Error> {
fn yaml_decode(string: &str) -> Result<Self, Error> {
Self::from_dec_str(string).map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))
}
}
@@ -48,7 +48,7 @@ impl_via_from_dec_str!(U256);
macro_rules! impl_via_serde_yaml {
($ty: ty) => {
impl YamlDecode for $ty {
fn yaml_decode(string: &String) -> Result<Self, Error> {
fn yaml_decode(string: &str) -> Result<Self, Error> {
serde_yaml::from_str(string)
.map_err(|e| Error::FailedToParseTest(format!("{:?}", e)))
}