diff options
| author | Nadrieril | 2019-04-08 18:23:55 +0200 | 
|---|---|---|
| committer | Nadrieril | 2019-04-08 18:23:55 +0200 | 
| commit | 47c0a3ca296a9b775275c2c7118a172b9f0bcc54 (patch) | |
| tree | c84f253528fdbea2f7d14aac1c909ec51c7b3184 /dhall_core | |
| parent | 00fa24b851ff6337cf4c5c63f82d95488180a413 (diff) | |
clippy
Diffstat (limited to 'dhall_core')
| -rw-r--r-- | dhall_core/src/core.rs | 14 | ||||
| -rw-r--r-- | dhall_core/src/lib.rs | 3 | ||||
| -rw-r--r-- | dhall_core/src/parser.rs | 6 | ||||
| -rw-r--r-- | dhall_core/src/printer.rs | 2 | 
4 files changed, 13 insertions, 12 deletions
diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs index 89506ec..39dea37 100644 --- a/dhall_core/src/core.rs +++ b/dhall_core/src/core.rs @@ -25,7 +25,7 @@ pub struct NaiveDouble(f64);  impl PartialEq for NaiveDouble {      fn eq(&self, other: &Self) -> bool { -        return self.0.to_bits() == other.0.to_bits(); +        self.0.to_bits() == other.0.to_bits()      }  } @@ -283,7 +283,7 @@ impl<S, A> Expr<S, A> {          F: Fn(&A) -> B,      {          let recurse = |e: &Expr<S, A>| -> Expr<S, B> { e.map_embed(map_embed) }; -        self.map_shallow(recurse, |x| x.clone(), map_embed, |x| x.clone()) +        self.map_shallow(recurse, S::clone, map_embed, Label::clone)      }      #[inline(always)] @@ -315,7 +315,7 @@ impl<S, A> Expr<S, A> {          F: Fn(&Label) -> Label,      {          let recurse = |e: &Self| -> Self { e.map_label(map_label) }; -        self.map_shallow(recurse, |x| x.clone(), |x| x.clone(), map_label) +        self.map_shallow(recurse, S::clone, A::clone, map_label)      }      #[inline(always)] @@ -333,10 +333,10 @@ impl<S: Clone, A: Clone> Expr<S, Expr<S, A>> {          match self {              ExprF::Embed(e) => e.clone(),              e => e.map_shallow( -                |e| e.squash_embed(), -                |x| x.clone(), +                <Expr<S, Expr<S, A>>>::squash_embed, +                S::clone,                  |_| unreachable!(), -                |x| x.clone(), +                Label::clone,              ),          }      } @@ -368,7 +368,7 @@ impl<SE, L, N, E> ExprF<SE, L, N, E> {          fn opt<T>(x: &Option<T>) -> Option<&T> {              x.as_ref()          } -        fn vec<T>(x: &Vec<T>) -> Vec<&T> { +        fn vec<T>(x: &[T]) -> Vec<&T> {              x.iter().collect()          }          fn btmap<L: Ord, SE>(x: &BTreeMap<L, SE>) -> BTreeMap<&L, &SE> { diff --git a/dhall_core/src/lib.rs b/dhall_core/src/lib.rs index 2042b04..9fddd1f 100644 --- a/dhall_core/src/lib.rs +++ b/dhall_core/src/lib.rs @@ -4,7 +4,8 @@  #![allow(      clippy::many_single_char_names,      clippy::should_implement_trait, -    clippy::new_without_default +    clippy::new_without_default, +    clippy::type_complexity  )]  mod core; diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs index 41a2ce7..9d77f52 100644 --- a/dhall_core/src/parser.rs +++ b/dhall_core/src/parser.rs @@ -180,7 +180,7 @@ macro_rules! make_parser {      );      ($( $submac:ident!( $name:ident<$o:ty> $($args:tt)* ); )*) => ( -        #[allow(non_camel_case_types, dead_code)] +        #[allow(non_camel_case_types, dead_code, clippy::large_enum_variant)]          #[derive(Debug)]          enum ParsedValue<'a> {              $( $name($o), )* @@ -283,7 +283,7 @@ make_parser! {          [label(l)] => {              if crate::Builtin::parse(&String::from(&l)).is_some() {                  Err( -                    format!("Builtin names are not allowed as bound variables") +                    "Builtin names are not allowed as bound variables".to_string()                  )?              }              l @@ -323,7 +323,7 @@ make_parser! {                      // "uXXXX"                      use std::convert::TryFrom;                      let c = u16::from_str_radix(&s[1..5], 16).unwrap(); -                    let c = char::try_from(c as u32).unwrap(); +                    let c = char::try_from(u32::from(c)).unwrap();                      std::iter::once(c).collect()                  }              } diff --git a/dhall_core/src/printer.rs b/dhall_core/src/printer.rs index 746b863..4f56fb6 100644 --- a/dhall_core/src/printer.rs +++ b/dhall_core/src/printer.rs @@ -318,7 +318,7 @@ impl Display for NaiveDouble {              f.write_str("NaN")          } else {              let s = format!("{}", v); -            if s.contains("e") || s.contains(".") { +            if s.contains('e') || s.contains('.') {                  f.write_str(&s)              } else {                  write!(f, "{}.0", s)  | 
