From cb9dfc1b9421e9814dac3ba6c78bad0d271f9d67 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Sat, 9 Mar 2019 16:24:14 +0100 Subject: Obey clippy lints Closes #14 --- dhall/src/imports.rs | 3 +-- dhall/src/lib.rs | 5 +++++ dhall/src/main.rs | 4 ++-- dhall/src/normalize.rs | 2 +- dhall/src/typecheck.rs | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) (limited to 'dhall') diff --git a/dhall/src/imports.rs b/dhall/src/imports.rs index 007ed47..22f7863 100644 --- a/dhall/src/imports.rs +++ b/dhall/src/imports.rs @@ -78,8 +78,7 @@ pub fn load_dhall_file( let resolve = |import: &Import| -> Expr { resolve_import(import, &root).unwrap() }; - let expr = expr.map_embed(&resolve).squash_embed(); - expr + expr.map_embed(&resolve).squash_embed() } else { panic_imports(&expr) }; diff --git a/dhall/src/lib.rs b/dhall/src/lib.rs index 8add5b6..a8643bb 100644 --- a/dhall/src/lib.rs +++ b/dhall/src/lib.rs @@ -1,6 +1,11 @@ #![feature(box_patterns)] #![feature(trace_macros)] #![feature(proc_macro_hygiene)] +#![allow( + clippy::type_complexity, + clippy::infallible_destructuring_match, + clippy::many_single_char_names +)] mod normalize; pub use crate::normalize::*; diff --git a/dhall/src/main.rs b/dhall/src/main.rs index edc6baf..3328d99 100644 --- a/dhall/src/main.rs +++ b/dhall/src/main.rs @@ -28,7 +28,7 @@ fn print_error(message: &str, source: &str, start: usize, end: usize) { BOLD.with(|| { print!(" -->"); }); - println!(" {}:{}:0", "(stdin)", line_number); + println!(" (stdin):{}:0", line_number); BOLD.with(|| { println!("{:w$} |", "", w = line_number_width); print!("{} |", line_number_str); @@ -88,6 +88,6 @@ fn main() { }; println!("{}", type_expr); - println!(""); + println!(); println!("{}", normalize::<_, X, _>(&expr)); } diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs index b2ee0f6..c23f887 100644 --- a/dhall/src/normalize.rs +++ b/dhall/src/normalize.rs @@ -175,7 +175,7 @@ where } BinOp(ListAppend, box ListLit(t1, xs), box ListLit(t2, ys)) => { // Drop type annotation if the result is nonempty - let t = if xs.len() == 0 && ys.len() == 0 { + let t = if xs.is_empty() && ys.is_empty() { t1.or(t2) } else { None diff --git a/dhall/src/typecheck.rs b/dhall/src/typecheck.rs index 28982fc..2916526 100644 --- a/dhall/src/typecheck.rs +++ b/dhall/src/typecheck.rs @@ -775,7 +775,7 @@ impl TypeError { TypeError { context: context.clone(), current: current.clone(), - type_message: type_message, + type_message, } } } -- cgit v1.2.3