summaryrefslogtreecommitdiff
path: root/dhall_core/src
diff options
context:
space:
mode:
Diffstat (limited to 'dhall_core/src')
-rw-r--r--dhall_core/src/core.rs2
-rw-r--r--dhall_core/src/lib.rs5
-rw-r--r--dhall_core/src/parser.rs19
3 files changed, 15 insertions, 11 deletions
diff --git a/dhall_core/src/core.rs b/dhall_core/src/core.rs
index 89fb6b9..e3e1f5c 100644
--- a/dhall_core/src/core.rs
+++ b/dhall_core/src/core.rs
@@ -97,7 +97,7 @@ impl Display for Label {
}
impl Label {
- pub fn from_str<'a>(s: &'a str) -> Label {
+ pub fn from_str(s: &str) -> Label {
s.to_owned().into()
}
}
diff --git a/dhall_core/src/lib.rs b/dhall_core/src/lib.rs
index 386d6bc..86b0363 100644
--- a/dhall_core/src/lib.rs
+++ b/dhall_core/src/lib.rs
@@ -1,5 +1,10 @@
#![feature(box_patterns)]
#![feature(trace_macros)]
+#![allow(
+ clippy::many_single_char_names,
+ clippy::should_implement_trait,
+ clippy::new_without_default
+)]
pub mod core;
pub use crate::core::*;
diff --git a/dhall_core/src/parser.rs b/dhall_core/src/parser.rs
index 2fa005a..357d006 100644
--- a/dhall_core/src/parser.rs
+++ b/dhall_core/src/parser.rs
@@ -28,7 +28,7 @@ fn debug_pair(pair: Pair<Rule>) -> String {
fn aux(s: &mut String, indent: usize, prefix: String, pair: Pair<Rule>) {
let indent_str = "| ".repeat(indent);
let rule = pair.as_rule();
- let contents = pair.as_str().clone();
+ let contents = pair.as_str();
let mut inner = pair.into_inner();
let mut first = true;
while let Some(p) = inner.next() {
@@ -109,10 +109,9 @@ macro_rules! match_iter {
match_iter!(@match 1, $iter $($rest)*);
#[allow(unused_mut)]
let mut $x = $iter.next();
- match $iter.next() {
- Some(_) => break Err(IterMatchError::TooManyItems),
- None => {},
- };
+ if $iter.next().is_some() {
+ break Err(IterMatchError::TooManyItems);
+ }
};
// Normal pattern
(@match 0, $iter:expr, $x:ident $($rest:tt)*) => {
@@ -135,10 +134,9 @@ macro_rules! match_iter {
// Check no elements remain
(@match 0, $iter:expr $(,)*) => {
- match $iter.next() {
- Some(_) => break Err(IterMatchError::TooManyItems),
- None => {},
- };
+ if $iter.next().is_some() {
+ break Err(IterMatchError::TooManyItems);
+ }
};
(@match $_:expr, $iter:expr) => {};
@@ -370,6 +368,7 @@ macro_rules! make_pest_parse_function {
($name:ident<$o:ty>; $submac:ident!( $($args:tt)* )) => (
#[allow(unused_variables)]
#[allow(non_snake_case)]
+ #[allow(clippy::all)]
fn $name<'a>(pair: Pair<'a, Rule>) -> ParseResult<$o> {
$submac!(pair; $($args)*)
}
@@ -813,7 +812,7 @@ rule!(final_expression<BoxExpr>;
children!(e: expression, _eoi: EOI) => e
);
-pub fn parse_expr<'i>(s: &'i str) -> ParseResult<BoxExpr> {
+pub fn parse_expr(s: &str) -> ParseResult<BoxExpr> {
let pairs = DhallParser::parse(Rule::final_expression, s)?;
// Match the only item in the pairs iterator
match_iter!(@panic; pairs; (p) => expression(p))