Repository: cobalt-org/liquid-rust
Pull request #358 (2019-09-07 02:10:56)

refactor: Switch to 2018 edition
- Had problems with pest for the compiler
- Had problems with liquid-derive in liquid

- [ ] Tests created for any new feature or regression tests for bugfixes.



Patch:
diff --git a/liquid-bin/Cargo.toml b/liquid-bin/Cargo.toml
index 0263933..79cc476 100644
--- a/liquid-bin/Cargo.toml
+++ b/liquid-bin/Cargo.toml
@@ -9,6 +9,7 @@ readme = "README.md"
 categories = ["template-engine"]
 keywords = ["liquid", "template", "templating", "language", "html"]
 license = "MIT"
+edition = "2018"
 
 [badges]
 azure-devops = { project = "cobalt-org", pipeline = "liquid-rust" }
diff --git a/liquid-bin/src/main.rs b/liquid-bin/src/main.rs
index 36a2808..c580b5f 100644
--- a/liquid-bin/src/main.rs
+++ b/liquid-bin/src/main.rs
@@ -1,11 +1,10 @@
 // Allow zero pointers for lazy_static. Otherwise clippy will complain.
 #![allow(unknown_lints)]
 
-extern crate liquid;
-extern crate structopt;
+use liquid;
 
-extern crate serde_json;
-extern crate serde_yaml;
+use serde_json;
+use serde_yaml;
 
 use std::ffi;
 use std::fs;
diff --git a/liquid-compiler/src/lib.rs b/liquid-compiler/src/lib.rs
index ad3b3ee..22360a0 100644
--- a/liquid-compiler/src/lib.rs
+++ b/liquid-compiler/src/lib.rs
@@ -15,12 +15,12 @@ mod registry;
 mod tag;
 mod text;
 
-pub use block::*;
-pub use filter::*;
-pub use filter_chain::*;
-pub use lang::*;
-pub use parser::*;
-pub use registry::*;
-pub use tag::*;
+pub use crate::block::*;
+pub use crate::filter::*;
+pub use crate::filter_chain::*;
+pub use crate::lang::*;
+pub use crate::parser::*;
+pub use crate::registry::*;
+pub use crate::tag::*;
 
-use text::Text;
+use crate::text::Text;
diff --git a/liquid-error/Cargo.toml b/liquid-error/Cargo.toml
index 2efc63b..fde75aa 100644
--- a/liquid-error/Cargo.toml
+++ b/liquid-error/Cargo.toml
@@ -9,6 +9,7 @@ readme = "README.md"
 categories = ["template-engine"]
 keywords = ["liquid", "template", "templating", "language", "html"]
 license = "MIT"
+edition = "2018"
 
 [badges]
 azure-devops = { project = "cobalt-org", pipeline = "liquid-rust" }
diff --git a/liquid-error/src/clone.rs b/liquid-error/src/clone.rs
index 015ec56..82167ca 100644
--- a/liquid-error/src/clone.rs
+++ b/liquid-error/src/clone.rs
@@ -41,7 +41,7 @@ impl CloneableError {
 }
 
 impl fmt::Display for CloneableError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         writeln!(f, "{}", self.error)
     }
 }
diff --git a/liquid-error/src/error.rs b/liquid-error/src/error.rs
index 807e594..014deba 100644
--- a/liquid-error/src/error.rs
+++ b/liquid-error/src/error.rs
@@ -108,7 +108,7 @@ impl Error {
 const ERROR_DESCRIPTION: &str = "liquid";
 
 impl fmt::Display for Error {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         writeln!(f, "{}: {}", ERROR_DESCRIPTION, self.inner.msg)?;
         for trace in &self.inner.user_backtrace {
             if let Some(trace) = trace.get_trace() {
diff --git a/liquid-error/src/lib.rs b/liquid-error/src/lib.rs
index bbefaea..a9c0ea6 100644
--- a/liquid-error/src/lib.rs
+++ b/liquid-error/src/lib.rs
@@ -9,7 +9,7 @@ mod error;
 mod result_ext;
 mod trace;
 
-pub use clone::*;
-pub use error::*;
-pub use result_ext::*;
-use trace::*;
+pub use crate::clone::*;
+pub use crate::error::*;
+pub use crate::result_ext::*;
+use crate::trace::*;
diff --git a/liquid-help-md/Cargo.toml b/liquid-help-md/Cargo.toml
index d94de69..813c056 100644
--- a/liquid-help-md/Cargo.toml
+++ b/liquid-help-md/Cargo.toml
@@ -9,6 +9,7 @@ readme = "README.md"
 categories = ["template-engine"]
 keywords = ["liquid", "template", "templating", "language", "html"]
 license = "MIT OR Apache-2.0"
+edition = "2018"
 
 [badges]
 azure-devops = { project = "cobalt-org", pipeline = "liquid-rust" }
diff --git a/liquid-help-md/src/lib.rs b/liquid-help-md/src/lib.rs
index 1a7e0cf..f2ff426 100644
--- a/liquid-help-md/src/lib.rs
+++ b/liquid-help-md/src/lib.rs
@@ -7,7 +7,7 @@ pub trait Renderable {
     fn render(&self, stream: &mut dyn std::io::Write) -> Result<(), Box<dyn std::error::Error>>;
 }
 
-impl Renderable for liquid::compiler::FilterReflection {
+impl Renderable for dyn liquid::compiler::FilterReflection {
     fn render_summary(
         &self,
         stream: &mut dyn std::io::Write,
@@ -55,7 +55,7 @@ impl Renderable for liquid::compiler::FilterReflection {
     }
 }
 
-impl Renderable for liquid::compiler::TagReflection {
+impl Renderable for dyn liquid::compiler::TagReflection {
     fn render_summary(
         &self,
         stream: &mut dyn std::io::Write,
@@ -81,7 +81,7 @@ impl Renderable for liquid::compiler::TagReflection {
     }
 }
 
-impl Renderable for liquid::compiler::BlockReflection {
+impl Renderable for dyn liquid::compiler::BlockReflection {
     fn render_summary(
         &self,
         stream: &mut dyn std::io::Write,
diff --git a/liquid-interpreter/Cargo.toml b/liquid-interpreter/Cargo.toml
index 726b3b1..3b381da 100644
--- a/liquid-interpreter/Cargo.toml
+++ b/liquid-interpreter/Cargo.toml
@@ -9,6 +9,7 @@ readme = "README.md"
 categories = ["template-engine"]
 keywords = ["liquid", "template", "templating", "language", "html"]
 license = "MIT"
+edition = "2018"
 
 [badges]
 azure-devops = { project = "cobalt-org", pipeline = "liquid-rust" }
diff --git a/liquid-interpreter/src/context.rs b/liquid-interpreter/src/context.rs
index db32d3d..fc9ff4a 100644
--- a/liquid-interpreter/src/context.rs
+++ b/liquid-interpreter/src/context.rs
@@ -160,7 +160,7 @@ impl<'g> Context<'g> {
     }
 
     /// Access the current `Stack`.
-    pub fn stack(&self) -> &Stack {
+    pub fn stack(&self) -> &Stack<'_> {
         &self.stack
     }
 
@@ -177,7 +177,7 @@ impl<'g> Context<'g> {
     /// to the caller.
     pub fn run_in_scope<RvalT, FnT>(&mut self, f: FnT) -> RvalT
     where
-        FnT: FnOnce(&mut Context) -> RvalT,
+        FnT: FnOnce(&mut Context<'_>) -> RvalT,
     {
         self.stack.push_frame();
         let result = f(self);
@@ -190,7 +190,7 @@ impl<'g> Context<'g> {
     /// to the caller.
     pub fn run_in_named_scope<RvalT, S: Into<String>, FnT>(&mut self, name: S, f: FnT) -> RvalT
     where
-        FnT: FnOnce(&mut Context) -> RvalT,
+        FnT: FnOnce(&mut Context<'_>) -> RvalT,
     {
         self.stack.push_named_frame(name);
         let result = f(self);
diff --git a/liquid-interpreter/src/expression.rs b/liquid-interpreter/src/expression.rs
index f0e53ca..1a18bbd 100644
--- a/liquid-interpreter/src/expression.rs
+++ b/liquid-interpreter/src/expression.rs
@@ -5,7 +5,7 @@ use liquid_value::Scalar;
 use liquid_value::Value;
 
 use super::Context;
-use variable::Variable;
+use crate::variable::Variable;
 
 /// An un-evaluated `Value`.
 #[derive(Debug, Clone, PartialEq)]
@@ -39,7 +39,7 @@ impl Expression {
     }
 
     /// Convert to a `Value`.
-    pub fn try_evaluate<'c>(&'c self, context: &'c Context) -> Option<&'c Value> {
+    pub fn try_evaluate<'c>(&'c self, context: &'c Context<'_>) -> Option<&'c Value> {
         let val = match *self {
             Expression::Literal(ref x) => &x,
             Expression::Variable(ref x) => {
@@ -51,7 +51,7 @@ impl Expression {
     }
 
     /// Convert to a `Value`.
-    pub fn evaluate<'c>(&'c self, context: &'c Context) -> Result<&'c Value> {
+    pub fn evaluate<'c>(&'c self, context: &'c Context<'_>) -> Result<&'c Value> {
         let val = match *self {
             Expression::Literal(ref x) => x,
             Expression::Variable(ref x) => {
@@ -64,7 +64,7 @@ impl Expression {
 }
 
 impl fmt::Display for Expression {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match *self {
             Expression::Literal(ref x) => write!(f, "{}", x.source()),
             Expression::Variable(ref x) => write!(f, "{}", x),
diff --git a/liquid-interpreter/src/lib.rs b/liquid-interpreter/src/lib.rs
index 28d9df4..386112c 100644
--- a/liquid-interpreter/src/lib.rs
+++ b/liquid-interpreter/src/lib.rs
@@ -3,14 +3,6 @@
 #![warn(missing_docs)]
 #![warn(unused_extern_crates)]
 
-extern crate anymap;
-extern crate itertools;
-extern crate liquid_error;
-extern crate liquid_value;
-
-#[cfg(test)]
-extern crate serde_yaml;
-
 mod context;
 mod expression;
 mod partials;
diff --git a/liquid-interpreter/src/renderable.rs b/liquid-interpreter/src/renderable.rs
index 86b9814..20e014f 100644
--- a/liquid-interpreter/src/renderable.rs
+++ b/liquid-interpreter/src/renderable.rs
@@ -8,12 +8,12 @@ use super::Context;
 /// Any object (tag/block) that can be rendered by liquid must implement this trait.
 pub trait Renderable: Send + Sync + Debug {
     /// Renders the Renderable instance given a Liquid context.
-    fn render(&self, context: &mut Context) -> Result<String> {
+    fn render(&self, context: &mut Context<'_>) -> Result<String> {
         let mut data = Vec::new();
         self.render_to(&mut data, context)?;
         Ok(String::from_utf8(data).expect("render only writes UTF-8"))
     }
 
     /// Renders the Renderable instance given a Liquid context.
-    fn render_to(&self, writer: &mut dyn Write, context: &mut Context) -> Result<()>;
+    fn render_to(&self, writer: &mut dyn Write, context: &mut Context<'_>) -> Result<()>;
 }
diff --git a/liquid-interpreter/src/stack.rs b/liquid-interpreter/src/stack.rs
index 8cf2a0c..376f1e6 100644
--- a/liquid-interpreter/src/stack.rs
+++ b/liquid-interpreter/src/stack.rs
@@ -85,14 +85,14 @@ impl<'g> Stack<'g> {
     }
 
     /// Recursively index into the stack.
-    pub fn try_get(&self, path: PathRef) -> Option<&Value> {
+    pub fn try_get(&self, path: PathRef<'_, '_>) -> Option<&Value> {
         let frame = self.find_path_frame(path)?;
 
         frame.try_get_variable(path)
     }
 
     /// Recursively index into the stack.
-    pub fn get(&self, path: PathRef) -> Result<&Value> {
+    pub fn get(&self, path: PathRef<'_, '_>) -> Result<&Value> {
         let frame = self.find_path_frame(path).ok_or_else(|| {
             let key = path
                 .iter()
@@ -118,7 +118,7 @@ impl<'g> Stack<'g> {
         globals
     }
 
-    fn find_path_frame<'a>(&'a self, path: PathRef) -> Option<&'a dyn ValueStore> {
+    fn find_path_frame<'a>(&'a self, path: PathRef<'_, '_>) -> Option<&'a dyn ValueStore> {
         let key = path.iter().next()?;
         let key = key.to_str();
         self.find_frame(key.as_ref())
diff --git a/liquid-interpreter/src/store.rs b/liquid-interpreter/src/store.rs
index bb30be7..ae23931 100644
--- a/liquid-interpreter/src/store.rs
+++ b/liquid-interpreter/src/store.rs
@@ -20,21 +20,21 @@ pub trait ValueStore: fmt::Debug {
     /// Notes to implementers:
     /// - Don't forget to reverse-index on negative array indexes
     /// - Don't forget about arr.first, arr.last.
-    fn contains_variable(&self, path: PathRef) -> bool;
+    fn contains_variable(&self, path: PathRef<'_, '_>) -> bool;
 
     /// Access a variable.
     ///
     /// Notes to implementers:
     /// - Don't forget to reverse-index on negative array indexes
     /// - Don't forget about arr.first, arr.last.
-    fn try_get_variable<'a>(&'a self, path: PathRef) -> Option<&'a Value>;
+    fn try_get_variable<'a>(&'a self, path: PathRef<'_, '_>) -> Option<&'a Value>;
 
     /// Access a variable.
     ///
     /// Notes to implementers:
     /// - Don't forget to reverse-index on negative array indexes
     /// - Don't forget about arr.first, arr.last.
-    fn get_variable<'a>(&'a self, path: PathRef) -> Result<&'a Value>;
+    fn get_variable<'a>(&'a self, path: PathRef<'_, '_>) -> Result<&'a Value>;
 }
 
 impl ValueStore for Object {
@@ -46,15 +46,15 @@ impl ValueStore for Object {
         self.keys().map(|s| s.as_ref()).collect()
     }
 
-    fn contains_variable(&self, path: PathRef) -> bool {
+    fn contains_variable(&self, path: PathRef<'_, '_>) -> bool {
         get_variable_option(self, path).is_some()
     }
 
-    fn try_get_variable<'a>(&'a self, path: PathRef) -> Option<&'a Value> {
+    fn try_get_variable<'a>(&'a self, path: PathRef<'_, '_>) -> Option<&'a Value> {
         get_variable_option(self, path)
     }
 
-    fn get_variable<'a>(&'a self, path: PathRef) -> Result<&'a Value> {
+    fn get_variable<'a>(&'a self, path: PathRef<'_, '_>) -> Result<&'a Value> {
         if let Some(res) = self.try_get_variable(path) {
             return Ok(res);
         } else {
@@ -88,7 +88,7 @@ impl ValueStore for Object {
     }
 }
 
-fn get_variable_option<'o>(obj: &'o Object, path: PathRef) -> Option<&'o Value> {
+fn get_variable_option<'o>(obj: &'o Object, path: PathRef<'_, '_>) -> Option<&'o Value> {
     let mut indexes = path.iter();
     let key = indexes.next()?;
     let key = key.to_str();
diff --git a/liquid-interpreter/src/template.rs b/liquid-interpreter/src/template.rs
index 3061d95..b17e8ba 100644
--- a/liquid-interpreter/src/template.rs
+++ b/liquid-interpreter/src/template.rs
@@ -19,7 +19,7 @@ impl Template {
 }
 
 impl Renderable for Template {
-    fn render_to(&self, writer: &mut dyn Write, context: &mut Context) -> Result<()> {
+    fn render_to(&self, writer: &mut dyn Write, context: &mut Context<'_>) -> Result<()> {
         for el in &self.elements {
             el.render_to(writer, context)?;
 
diff --git a/liquid-interpreter/src/variable.rs b/liquid-interpreter/src/variable.rs
index 452aedc..205d7f7 100644
--- a/liquid-interpreter/src/variable.rs
+++ b/liquid-interpreter/src/variable.rs
@@ -30,7 +30,7 @@ impl Variable {
     }
 
     /// Convert to a `Path`.
-    pub fn try_evaluate<'c>(&'c self, context: &'c Context) -> Option<Path<'c>> {
+    pub fn try_evaluate<'c>(&'c self, context: &'c Context<'_>) -> Option<Path<'c>> {
         let mut path = Path::with_index(self.variable.as_ref());
         path.reserve(self.indexes.len());
         for expr in &self.indexes {
@@ -42,7 +42,7 @@ impl Variable {
     }
 
     /// Convert to a `Path`.
-    pub fn evaluate<'c>(&'c self, context: &'c Context) -> Result<Path<'c>> {
+    pub fn evaluate<'c>(&'c self, context: &'c Context<'_>) -> Result<Path<'c>> {
         let mut path = Path::with_index(self.variable.as_ref());
         path.reserve(self.indexes.len());
         for expr in &self.indexes {
@@ -72,7 +72,7 @@ impl Extend<Expression> for Variable {
 }
 
 impl fmt::Display for Variable {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         write!(f, "{}", self.variable.render())?;
         for index in self.indexes.iter() {
             write!(f, "[{}]", index)?;
diff --git a/liquid-value/Cargo.toml b/liquid-value/Cargo.toml
index 37b5dd6..7435171 100644
--- a/liquid-value/Cargo.toml
+++ b/liquid-value/Cargo.toml
@@ -9,6 +9,7 @@ readme = "README.md"
 categories = ["template-engine"]
 keywords = ["liquid", "template", "templating", "language", "html"]
 license = "MIT"
+edition = "2018"
 
 [badges]
 azure-devops = { project = "cobalt-org", pipeline = "liquid-rust" }
diff --git a/liquid-value/src/lib.rs b/liquid-value/src/lib.rs
index ab045fa..78b17c3 100644
--- a/liquid-value/src/lib.rs
+++ b/liquid-value/src/lib.rs
@@ -6,10 +6,6 @@
 
 #[macro_use]
 extern crate serde;
-extern crate chrono;
-extern crate itertools;
-extern crate liquid_error;
-extern crate num_traits;
 
 #[macro_use]
 mod macros;
@@ -25,7 +21,7 @@ pub mod error {
     pub use liquid_error::*;
 }
 
-pub use path::*;
-pub use scalar::*;
-pub use ser::*;
-pub use values::*;
+pub use crate::path::*;
+pub use crate::scalar::*;
+pub use crate::ser::*;
+pub use crate::values::*;
diff --git a/liquid-value/src/map.rs b/liquid-value/src/map.rs
index f059501..f6dff50 100644
--- a/liquid-value/src/map.rs
+++ b/liquid-value/src/map.rs
@@ -112,7 +112,7 @@ impl Map {
 
     /// Gets the given key's corresponding entry in the map for in-place
     /// manipulation.
-    pub fn entry<S>(&mut self, key: S) -> Entry
+    pub fn entry<S>(&mut self, key: S) -> Entry<'_>
     where
         S: Into<Key>,
     {
@@ -137,7 +137,7 @@ impl Map {
 
     /// Gets an iterator over the entries of the map.
     #[inline]
-    pub fn iter(&self) -> Iter {
+    pub fn iter(&self) -> Iter<'_> {
         Iter {
             iter: self.map.iter(),
         }
@@ -145,7 +145,7 @@ impl Map {
 
     /// Gets a mutable iterator over the entries of the map.
     #[inline]
-    pub fn iter_mut(&mut self) -> IterMut {
+    pub fn iter_mut(&mut self) -> IterMut<'_> {
         IterMut {
             iter: self.map.iter_mut(),
         }
@@ -153,7 +153,7 @@ impl Map {
 
     /// Gets an iterator over the keys of the map.
     #[inline]
-    pub fn keys(&self) -> Keys {
+    pub fn keys(&self) -> Keys<'_> {
         Keys {
             iter: self.map.keys(),
         }
@@ -161,7 +161,7 @@ impl Map {
 
     /// Gets an iterator over the values of the map.
     #[inline]
-    pub fn values(&self) -> Values {
+    pub fn values(&self) -> Values<'_> {
         Values {
             iter: self.map.values(),
         }
@@ -169,7 +169,7 @@ impl Map {
 
     /// Gets an iterator over mutable values of the map.
     #[inline]
-    pub fn values_mut(&mut self) -> ValuesMut {
+    pub fn values_mut(&mut self) -> ValuesMut<'_> {
         ValuesMut {
             iter: self.map.values_mut(),
         }
@@ -257,7 +257,7 @@ where
 
 impl Debug for Map {
     #[inline]
-    fn fmt(&self, formatter: &mut fmt::Formatter) -> Result<(), fmt::Error> {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
         self.map.fmt(formatter)
     }
 }
@@ -289,7 +289,7 @@ impl<'de> de::Deserialize<'de> for Map {
         impl<'de> de::Visitor<'de> for Visitor {
             type Value = Map;
 
-            fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+            fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
                 formatter.write_str("a map")
             }
 
diff --git a/liquid-value/src/path.rs b/liquid-value/src/path.rs
index e021915..e4566fc 100644
--- a/liquid-value/src/path.rs
+++ b/liquid-value/src/path.rs
@@ -33,7 +33,7 @@ impl<'s> Path<'s> {
     }
 
     /// Access the `Value` reference.
-    pub fn iter(&self) -> PathIter {
+    pub fn iter(&self) -> PathIter<'_, '_> {
         PathIter(self.0.iter())
     }
 
@@ -74,7 +74,7 @@ impl<'s> AsRef<[ScalarCow<'s>]> for Path<'s> {
 }
 
 impl<'s> fmt::Display for Path<'s> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let data = itertools::join(self.iter().map(ScalarCow::render), ".");
         write!(f, "{}", data)
     }
diff --git a/liquid-value/src/scalar.rs b/liquid-value/src/scalar.rs
index 6f4784b..ab5063f 100644
--- a/liquid-value/src/scalar.rs
+++ b/liquid-value/src/scalar.rs
@@ -33,12 +33,12 @@ impl<'s> ScalarCow<'s> {
     }
 
     /// A `Display` for a `Scalar` as source code.
-    pub fn source(&self) -> ScalarSource {
+    pub fn source(&self) -> ScalarSource<'_> {
         ScalarSource(&self.0)
     }
 
     /// A `Display` for a `Scalar` rendered for the user.
-    pub fn render(&self) -> ScalarRendered {
+    pub fn render(&self) -> ScalarRendered<'_> {
         ScalarRendered(&self.0)
     }
 
@@ -62,7 +62,7 @@ impl<'s> ScalarCow<'s> {
     }
 
     /// Interpret as a string.
-    pub fn to_str(&self) -> borrow::Cow<str> {
+    pub fn to_str(&self) -> borrow::Cow<'_, str> {
         match self.0 {
             ScalarCowEnum::Integer(ref x) => borrow::Cow::Owned(x.to_string()),
             ScalarCowEnum::Float(ref x) => borrow::Cow::Owned(x.to_string()),
@@ -303,7 +303,7 @@ impl<'s> PartialOrd<str> for ScalarCow<'s> {
 pub struct ScalarSource<'s>(&'s ScalarCowEnum<'s>);
 
 impl<'s> fmt::Display for ScalarSource<'s> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self.0 {
             ScalarCowEnum::Integer(ref x) => write!(f, "{}", x),
             ScalarCowEnum::Float(ref x) => write!(f, "{}", x),
@@ -319,7 +319,7 @@ impl<'s> fmt::Display for ScalarSource<'s> {
 pub struct ScalarRendered<'s>(&'s ScalarCowEnum<'s>);
 
 impl<'s> fmt::Display for ScalarRendered<'s> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // Must match `ScalarCow::to_str`
         match self.0 {
             ScalarCowEnum::Integer(ref x) => write!(f, "{}", x),
@@ -404,8 +404,8 @@ fn parse_date(s: &str) -> Option<Date> {
 mod test {
     use super::*;
 
-    static TRUE: ScalarCow = ScalarCow(ScalarCowEnum::Bool(true));
-    static FALSE: ScalarCow = ScalarCow(ScalarCowEnum::Bool(false));
+    static TRUE: ScalarCow<'_> = ScalarCow(ScalarCowEnum::Bool(true));
+    static FALSE: ScalarCow<'_> = ScalarCow(ScalarCowEnum::Bool(false));
 
     #[test]
     fn test_to_str_bool() {
@@ -414,22 +414,22 @@ mod test {
 
     #[test]
     fn test_to_str_integer() {
-        let val: ScalarCow = 42i32.into();
+        let val: ScalarCow<'_> = 42i32.into();
         assert_eq!(val.to_str(), "42");
     }
 
     #[test]
     fn test_to_str_float() {
-        let val: ScalarCow = 42f64.into();
+        let val: ScalarCow<'_> = 42f64.into();
         assert_eq!(val.to_str(), "42");
 
-        let val: ScalarCow = 42.34.into();
+        let val: ScalarCow<'_> = 42.34.into();
         assert_eq!(val.to_str(), "42.34");
     }
 
     #[test]
     fn test_to_str_str() {
-        let val: ScalarCow = "foobar".into();
+        let val: ScalarCow<'_> = "foobar".into();
         assert_eq!(val.to_str(), "foobar");
     }
 
@@ -440,28 +440,28 @@ mod test {
 
     #[test]
     fn test_to_integer_integer() {
-        let val: ScalarCow = 42i32.into();
+        let val: ScalarCow<'_> = 42i32.into();
         assert_eq!(val.to_integer(), Some(42i32));
     }
 
     #[test]
     fn test_to_integer_float() {
-        let val: ScalarCow = 42f64.into();
+        let val: ScalarCow<'_> = 42f64.into();
         assert_eq!(val.to_integer(), None);
 
-        let val: ScalarCow = 42.34.into();
+        let val: ScalarCow<'_> = 42.34.into();
         assert_eq!(val.to_integer(), None);
     }
 
     #[test]
     fn test_to_integer_str() {
-        let val: ScalarCow = "foobar".into();
+        let val: ScalarCow<'_> = "foobar".into();
         assert_eq!(val.to_integer(), None);
 
-        let val: ScalarCow = "42.34".into();
+        let val: ScalarCow<'_> = "42.34".into();
         assert_eq!(val.to_integer(), None);
 
-        let val: ScalarCow = "42".into();
+        let val: ScalarCow<'_> = "42".into();
         assert_eq!(val.to_integer(), Some(42));
     }
 
@@ -472,28 +472,28 @@ mod test {
 
     #[test]
     fn test_to_float_integer() {
-        let val: ScalarCow = 42i32.into();
+        let val: ScalarCow<'_> = 42i32.into();
         assert_eq!(val.to_float(), Some(42f64));
     }
 
     #[test]
     fn test_to_float_float() {
-        let val: ScalarCow = 42f64.into();
+        let val: ScalarCow<'_> = 42f64.into();
         assert_eq!(val.to_float(), Some(42f64));
 
-        let val: ScalarCow = 42.34.into();
+        let val: ScalarCow<'_> = 42.34.into();
         assert_eq!(val.to_float(), Some(42.34));
     }
 
     #[test]
     fn test_to_float_str() {
-        let val: ScalarCow = "foobar".into();
+        let val: ScalarCow<'_> = "foobar".into();
         assert_eq!(val.to_float(), None);
 
-        let val: ScalarCow = "42.34".into();
+        let val: ScalarCow<'_> = "42.34".into();
         assert_eq!(val.to_float(), Some(42.34));
 
-        let val: ScalarCow = "42".into();
+        let val: ScalarCow<'_> = "42".into();
         assert_eq!(val.to_float(), Some(42f64));
     }
 
@@ -504,35 +504,35 @@ mod test {
 
     #[test]
     fn test_to_bool_integer() {
-        let val: ScalarCow = 42i32.into();
+        let val: ScalarCow<'_> = 42i32.into();
         assert_eq!(val.to_bool(), None);
     }
 
     #[test]
     fn test_to_bool_float() {
-        let val: ScalarCow = 42f64.into();
+        let val: ScalarCow<'_> = 42f64.into();
         assert_eq!(val.to_bool(), None);
 
-        let val: ScalarCow = 42.34.into();
+        let val: ScalarCow<'_> = 42.34.into();
         assert_eq!(val.to_bool(), None);
     }
 
     #[test]
     fn test_to_bool_str() {
-        let val: ScalarCow = "foobar".into();
+        let val: ScalarCow<'_> = "foobar".into();
         assert_eq!(val.to_bool(), None);
 
-        let val: ScalarCow = "true".into();
+        let val: ScalarCow<'_> = "true".into();
         assert_eq!(val.to_bool(), None);
 
-        let val: ScalarCow = "false".into();
+        let val: ScalarCow<'_> = "false".into();
         assert_eq!(val.to_bool(), None);
     }
 
     #[test]
     fn integer_equality() {
-        let val: ScalarCow = 42i32.into();
-        let zero: ScalarCow = 0i32.into();
+        let val: ScalarCow<'_> = 42i32.into();
+        let zero: ScalarCow<'_> = 0i32.into();
         assert_eq!(val, val);
         assert_eq!(zero, zero);
         assert!(val != zero);
@@ -541,8 +541,8 @@ mod test {
 
     #[test]
     fn integers_have_ruby_truthiness() {
-        let val: ScalarCow = 42i32.into();
-        let zero: ScalarCow = 0i32.into();
+        let val: ScalarCow<'_> = 42i32.into();
+        let zero: ScalarCow<'_> = 0i32.into();
         assert_eq!(TRUE, val);
         assert_eq!(val, TRUE);
         assert!(val.is_truthy());
@@ -554,8 +554,8 @@ mod test {
 
     #[test]
     fn float_equality() {
-        let val: ScalarCow = 42f64.into();
-        let zero: ScalarCow = 0f64.into();
+        let val: ScalarCow<'_> = 42f64.into();
+        let zero: ScalarCow<'_> = 0f64.into();
         assert_eq!(val, val);
         assert_eq!(zero, zero);
         assert!(val != zero);
@@ -564,8 +564,8 @@ mod test {
 
     #[test]
     fn floats_have_ruby_truthiness() {
-        let val: ScalarCow = 42f64.into();
-        let zero: ScalarCow = 0f64.into();
+        let val: ScalarCow<'_> = 42f64.into();
+        let zero: ScalarCow<'_> = 0f64.into();
         assert_eq!(TRUE, val);
         assert_eq!(val, TRUE);
         assert!(val.is_truthy());
@@ -591,9 +591,9 @@ mod test {
 
     #[test]
     fn string_equality() {
-        let alpha: ScalarCow = "alpha".into();
-        let beta: ScalarCow = "beta".into();
-        let empty: ScalarCow = "".into();
+        let alpha: ScalarCow<'_> = "alpha".into();
+        let beta: ScalarCow<'_> = "beta".into();
+        let empty: ScalarCow<'_> = "".into();
         assert_eq!(alpha, alpha);
         assert_eq!(empty, empty);
         assert!(alpha != beta);
@@ -603,8 +603,8 @@ mod test {
     #[test]
     fn strings_have_ruby_truthiness() {
         // all strings in ruby are true
-        let alpha: ScalarCow = "alpha".into();
-        let empty: ScalarCow = "".into();
+        let alpha: ScalarCow<'_> = "alpha".into();
+        let empty: ScalarCow<'_> = "".into();
         assert_eq!(TRUE, alpha);
         assert_eq!(alpha, TRUE);
         assert!(alpha.is_truthy());
diff --git a/liquid-value/src/ser.rs b/liquid-value/src/ser.rs
index 3574fa2..aeb34f6 100644
--- a/liquid-value/src/ser.rs
+++ b/liquid-value/src/ser.rs
@@ -6,7 +6,7 @@ use serde::{self, Serialize};
 
 use super::Object;
 use super::Value;
-use error;
+use crate::error;
 
 /// Convert a `T` into `liquid_value:Value`.
 ///
@@ -28,7 +28,7 @@ where
 struct SerError(error::Error);
 
 impl fmt::Display for SerError {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         writeln!(f, "{}", self.0)
     }
 }
@@ -371,7 +371,7 @@ impl serde::ser::SerializeMap for SerializeMap {
             SerializeMap::Map {
                 ref mut next_key, ..
             } => {
-                *next_key = Some(try!(key.serialize(MapKeySerializer)));
+                *next_key = Some(r#try!(key.serialize(MapKeySerializer)));
                 Ok(())
             }
         }
@@ -596,7 +596,7 @@ impl serde::ser::SerializeStruct for SerializeMap {
     {
         match *self {
             SerializeMap::Map { .. } => {
-                try!(serde::ser::SerializeMap::serialize_key(self, key));
+                r#try!(serde::ser::SerializeMap::serialize_key(self, key));
                 serde::ser::SerializeMap::serialize_value(self, value)
             }
         }
diff --git a/liquid-value/src/values.rs b/liquid-value/src/values.rs
index b061b45..7ee5c41 100644
--- a/liquid-value/src/values.rs
+++ b/liquid-value/src/values.rs
@@ -50,17 +50,17 @@ impl Value {
     }
 
     /// A `Display` for a `Scalar` as source code.
-    pub fn source(&self) -> ValueSource {
+    pub fn source(&self) -> ValueSource<'_> {
         ValueSource(&self)
     }
 
     /// A `Display` for a `Value` rendered for the user.
-    pub fn render(&self) -> ValueRendered {
+    pub fn render(&self) -> ValueRendered<'_> {
         ValueRendered(&self)
     }
 
     /// Interpret as a string.
-    pub fn to_str(&self) -> borrow::Cow<str> {
+    pub fn to_str(&self) -> borrow::Cow<'_, str> {
         match *self {
             Value::Scalar(ref x) => x.to_str(),
             Value::Array(ref x) => {
@@ -282,7 +282,7 @@ impl Value {
     }
 
     /// Access a contained `Value`.
-    pub fn get<'s>(&'s self, index: &ScalarCow) -> Option<&'s Self> {
+    pub fn get<'s>(&'s self, index: &ScalarCow<'_>) -> Option<&'s Self> {
         match *self {
             Value::Array(ref x) => {
                 if let Some(index) = index.to_integer() {
@@ -364,7 +364,7 @@ impl PartialOrd<Value> for Value {
 pub struct ValueSource<'s>(&'s Value);
 
 impl<'s> fmt::Display for ValueSource<'s> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         match self.0 {
             Value::Scalar(ref x) => write!(f, "{}", x.render())?,
             Value::Array(ref x) => {
@@ -394,7 +394,7 @@ impl<'s> fmt::Display for ValueSource<'s> {
 pub struct ValueRendered<'s>(&'s Value);
 
 impl<'s> fmt::Display for ValueRendered<'s> {
-    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         // Must match `Value::to_str`
         match self.0 {
             Value::Scalar(ref x) => write!(f, "{}", x.render())?,


Test patch:
diff --git a/liquid-value/tests/value.rs b/liquid-value/tests/value.rs
index eefcadc..cfaf225 100644
--- a/liquid-value/tests/value.rs
+++ b/liquid-value/tests/value.rs
@@ -1,5 +1,5 @@
-extern crate liquid_value;
-extern crate serde_yaml;
+use liquid_value;
+use serde_yaml;
 
 #[macro_use]
 extern crate difference;
diff --git a/tests/conformance_ruby/standard_filter_test.rs b/tests/conformance_ruby/standard_filter_test.rs
index 1fd6575..58b4e3d 100644
--- a/tests/conformance_ruby/standard_filter_test.rs
+++ b/tests/conformance_ruby/standard_filter_test.rs
@@ -1,4 +1,4 @@
-use test_helper::*;
+use crate::test_helper::*;
 
 #[test]
 fn test_size() {