mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-22 22:34:45 +00:00
Add various fixes to clippy lints
Thou shalt appease clippy
This commit is contained in:
@@ -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)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user