Repository: djc/askama
Pull request #173 (2018-12-07 20:21:40)

2018
This also updates the Rocket dependencies.


Patch:
diff --git a/README.md b/README.md
index 6defabd..8924c5e 100644
--- a/README.md
+++ b/README.md
@@ -97,7 +97,6 @@ Hello, {{ name }}!
 In any Rust file inside your crate, add the following:
 
 ```rust
-#[macro_use]
 extern crate askama; // for the Template trait and custom derive macro
 
 use askama::Template; // bring trait in scope
diff --git a/askama/Cargo.toml b/askama/Cargo.toml
index 79a8103..7c85a92 100644
--- a/askama/Cargo.toml
+++ b/askama/Cargo.toml
@@ -11,6 +11,7 @@ repository = "https://github.com/djc/askama"
 license = "MIT OR Apache-2.0"
 workspace = ".."
 readme = "../README.md"
+edition = "2018"
 
 [badges]
 appveyor = { repository = "djc/askama" }
@@ -28,7 +29,7 @@ with-actix-web = ["actix-web", "askama_derive/actix-web", "mime_guess"]
 askama_derive = { version = "0.8.0", path = "../askama_derive" }
 askama_shared = { version = "0.7.2", path = "../askama_shared" }
 iron = { version = ">= 0.5, < 0.7", optional = true }
-rocket = { version = "0.3", optional = true }
+rocket = { version = "0.4", optional = true }
 actix-web = { version = "0.7", optional = true }
 mime_guess = { version = "2.0.0-alpha", optional = true }
 
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index c70d87b..7381af7 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -400,7 +400,7 @@
 #![allow(unused_imports)]
 #[macro_use]
 extern crate askama_derive;
-extern crate askama_shared as shared;
+use askama_shared as shared;
 
 use std::fs::{self, DirEntry};
 use std::io;
@@ -415,16 +415,16 @@ pub trait Template {
         Ok(buf)
     }
     /// Renders the template to the given `writer` buffer
-    fn render_into(&self, writer: &mut std::fmt::Write) -> Result<()>;
+    fn render_into(&self, writer: &mut dyn std::fmt::Write) -> Result<()>;
     /// Helper function to inspect the template's extension
     fn extension() -> Option<&'static str>
     where
         Self: Sized;
 }
 
+pub use crate::shared::filters;
+pub use crate::shared::{read_config_file, Error, MarkupDisplay, Result};
 pub use askama_derive::*;
-pub use shared::filters;
-pub use shared::{read_config_file, Error, MarkupDisplay, Result};
 
 #[cfg(feature = "with-iron")]
 pub mod iron {
@@ -478,7 +478,7 @@ pub mod actix_web {
     }
 }
 
-fn visit_dirs(dir: &Path, cb: &Fn(&DirEntry)) -> io::Result<()> {
+fn visit_dirs(dir: &Path, cb: &dyn Fn(&DirEntry)) -> io::Result<()> {
     if dir.is_dir() {
         for entry in fs::read_dir(dir)? {
             let entry = entry?;
diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml
index 2a95a77..7096597 100644
--- a/askama_derive/Cargo.toml
+++ b/askama_derive/Cargo.toml
@@ -7,6 +7,7 @@ homepage = "https://github.com/djc/askama"
 repository = "https://github.com/djc/askama"
 license = "MIT/Apache-2.0"
 workspace = ".."
+edition = "2018"
 
 [lib]
 proc-macro = true
diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs
index 128811a..61a82bd 100644
--- a/askama_derive/src/generator.rs
+++ b/askama_derive/src/generator.rs
@@ -1,7 +1,7 @@
 use super::{get_template_source, Context, Heritage};
-use input::TemplateInput;
-use parser::{Cond, Expr, MatchParameter, MatchVariant, Node, Target, When, WS};
-use shared::filters;
+use crate::input::TemplateInput;
+use crate::parser::{Cond, Expr, MatchParameter, MatchVariant, Node, Target, When, WS};
+use askama_shared::filters;
 
 use proc_macro2::Span;
 
@@ -13,7 +13,7 @@ use std::{cmp, hash, mem, str};
 
 use syn;
 
-use parser::parse;
+use crate::parser::parse;
 
 pub(crate) fn generate(
     input: &TemplateInput,
diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs
index f4da43c..72d5d20 100644
--- a/askama_derive/src/input.rs
+++ b/askama_derive/src/input.rs
@@ -2,7 +2,7 @@ use proc_macro2::TokenStream;
 
 use quote::ToTokens;
 
-use shared::{Config, Syntax};
+use askama_shared::{Config, Syntax};
 
 use std::path::PathBuf;
 
diff --git a/askama_derive/src/lib.rs b/askama_derive/src/lib.rs
index 5c84004..cf5ead9 100644
--- a/askama_derive/src/lib.rs
+++ b/askama_derive/src/lib.rs
@@ -1,22 +1,19 @@
-extern crate askama_shared as shared;
+extern crate proc_macro;
 #[macro_use]
 extern crate nom;
-extern crate proc_macro;
-extern crate proc_macro2;
 #[macro_use]
 extern crate quote;
-extern crate syn;
 
 mod generator;
 mod input;
 mod parser;
 
-use input::{Print, Source, TemplateInput};
-use parser::{Expr, Macro, Node};
+use crate::input::{Print, Source, TemplateInput};
+use crate::parser::{Expr, Macro, Node};
+use askama_shared::{read_config_file, Config};
 use proc_macro::TokenStream;
-use shared::{read_config_file, Config};
 
-use parser::parse;
+use crate::parser::parse;
 use std::collections::HashMap;
 use std::fs;
 use std::path::{Path, PathBuf};
@@ -220,7 +217,7 @@ fn get_template_source(tpl_path: &Path) -> String {
 #[cfg(test)]
 mod tests {
     use super::get_template_source;
-    use Config;
+    use crate::Config;
 
     #[test]
     fn get_source() {
diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs
index 742a7a2..e1a7fc0 100644
--- a/askama_derive/src/parser.rs
+++ b/askama_derive/src/parser.rs
@@ -4,7 +4,7 @@
 use nom;
 use std::str;
 
-use shared::Syntax;
+use askama_shared::Syntax;
 
 #[derive(Debug)]
 pub enum Expr<'a> {
@@ -123,7 +123,7 @@ fn take_content<'a>(
     i: Input<'a>,
     s: &'a Syntax<'a>,
 ) -> Result<(Input<'a>, Node<'a>), nom::Err<Input<'a>>> {
-    use parser::ContentState::*;
+    use crate::parser::ContentState::*;
     let bs = s.block_start.as_bytes()[0];
     let be = s.block_start.as_bytes()[1];
     let cs = s.comment_start.as_bytes()[0];
@@ -771,7 +771,7 @@ pub fn parse<'a>(src: &'a str, syntax: &'a Syntax<'a>) -> Vec<Node<'a>> {
 
 #[cfg(test)]
 mod tests {
-    use shared::Syntax;
+    use askama_shared::Syntax;
 
     fn check_ws_split(s: &str, res: &(&str, &str, &str)) {
         let node = super::split_ws_parts(s.as_bytes());
diff --git a/askama_escape/Cargo.toml b/askama_escape/Cargo.toml
index ee84891..983a281 100644
--- a/askama_escape/Cargo.toml
+++ b/askama_escape/Cargo.toml
@@ -9,6 +9,7 @@ homepage = "https://github.com/djc/askama"
 repository = "https://github.com/djc/askama"
 license = "MIT OR Apache-2.0"
 workspace = ".."
+edition = "2018"
 
 [badges]
 appveyor = { repository = "djc/askama" }
diff --git a/askama_escape/benches/all.rs b/askama_escape/benches/all.rs
index e7dc7ed..af28c43 100644
--- a/askama_escape/benches/all.rs
+++ b/askama_escape/benches/all.rs
@@ -1,4 +1,3 @@
-extern crate askama_escape;
 #[macro_use]
 extern crate criterion;
 
diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs
index b967f1f..8c23530 100644
--- a/askama_escape/src/lib.rs
+++ b/askama_escape/src/lib.rs
@@ -35,7 +35,7 @@ impl<T> Display for MarkupDisplay<T>
 where
     T: Display,
 {
-    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+    fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
         match *self {
             MarkupDisplay::Unsafe(ref t) => escape(&t.to_string()).fmt(f),
             MarkupDisplay::Safe(ref t) => t.fmt(f),
@@ -43,7 +43,7 @@ where
     }
 }
 
-pub fn escape(s: &str) -> Escaped {
+pub fn escape(s: &str) -> Escaped<'_> {
     Escaped {
         bytes: s.as_bytes(),
     }
@@ -64,7 +64,7 @@ pub struct Escaped<'a> {
 }
 
 impl<'a> ::std::fmt::Display for Escaped<'a> {
-    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
         let mut start = 0;
         for (i, b) in self.bytes.iter().enumerate() {
             if b.wrapping_sub(b'"') <= FLAG {
diff --git a/askama_shared/Cargo.toml b/askama_shared/Cargo.toml
index 39ee358..f8fafe3 100644
--- a/askama_shared/Cargo.toml
+++ b/askama_shared/Cargo.toml
@@ -7,6 +7,7 @@ homepage = "https://github.com/djc/askama"
 repository = "https://github.com/djc/askama"
 license = "MIT/Apache-2.0"
 workspace = ".."
+edition = "2018"
 
 [dependencies]
 askama_escape = { version = "0.1.0", path = "../askama_escape" }
diff --git a/askama_shared/src/error.rs b/askama_shared/src/error.rs
index 90ba571..650e275 100644
--- a/askama_shared/src/error.rs
+++ b/askama_shared/src/error.rs
@@ -49,7 +49,7 @@ impl ErrorTrait for Error {
         }
     }
 
-    fn cause(&self) -> Option<&ErrorTrait> {
+    fn cause(&self) -> Option<&dyn ErrorTrait> {
         match *self {
             Error::Fmt(ref err) => err.cause(),
             #[cfg(feature = "serde_json")]
@@ -60,7 +60,7 @@ impl ErrorTrait for Error {
 }
 
 impl Display for Error {
-    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
+    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
         match *self {
             Error::Fmt(ref err) => write!(formatter, "formatting error: {}", err),
 
diff --git a/askama_shared/src/filters/json.rs b/askama_shared/src/filters/json.rs
index 2df6db6..56053be 100644
--- a/askama_shared/src/filters/json.rs
+++ b/askama_shared/src/filters/json.rs
@@ -1,6 +1,6 @@
-use error::{Error, Result};
+use crate::error::{Error, Result};
 use serde::Serialize;
-use MarkupDisplay;
+use askama_escape::MarkupDisplay;
 
 /// Serialize to JSON (requires `serde_json` feature)
 ///
diff --git a/askama_shared/src/filters/mod.rs b/askama_shared/src/filters/mod.rs
index cf94092..85ff8b2 100644
--- a/askama_shared/src/filters/mod.rs
+++ b/askama_shared/src/filters/mod.rs
@@ -10,8 +10,8 @@ mod json;
 #[cfg(feature = "serde_json")]
 pub use self::json::json;
 
+use crate::error::Error::Fmt;
 use askama_escape::MarkupDisplay;
-use error::Error::Fmt;
 use humansize::{file_size_opts, FileSize};
 use num_traits::cast::NumCast;
 use num_traits::Signed;
@@ -97,7 +97,7 @@ pub fn format() {}
 ///
 /// A single newline becomes an HTML line break `<br>` and a new line
 /// followed by a blank line becomes a paragraph break `<p>`.
-pub fn linebreaks(s: &fmt::Display) -> Result<String> {
+pub fn linebreaks(s: &dyn fmt::Display) -> Result<String> {
     let s = s.to_string();
     let linebroken = s.replace("\n\n", "</p><p>").replace("\n", "<br/>");
 
@@ -105,41 +105,41 @@ pub fn linebreaks(s: &fmt::Display) -> Result<String> {
 }
 
 /// Converts all newlines in a piece of plain text to HTML line breaks
-pub fn linebreaksbr(s: &fmt::Display) -> Result<String> {
+pub fn linebreaksbr(s: &dyn fmt::Display) -> Result<String> {
     let s = s.to_string();
     Ok(s.replace("\n", "<br/>"))
 }
 
 /// Converts to lowercase
-pub fn lower(s: &fmt::Display) -> Result<String> {
+pub fn lower(s: &dyn fmt::Display) -> Result<String> {
     let s = s.to_string();
     Ok(s.to_lowercase())
 }
 
 /// Alias for the `lower()` filter
-pub fn lowercase(s: &fmt::Display) -> Result<String> {
+pub fn lowercase(s: &dyn fmt::Display) -> Result<String> {
     lower(s)
 }
 
 /// Converts to uppercase
-pub fn upper(s: &fmt::Display) -> Result<String> {
+pub fn upper(s: &dyn fmt::Display) -> Result<String> {
     let s = s.to_string();
     Ok(s.to_uppercase())
 }
 
 /// Alias for the `upper()` filter
-pub fn uppercase(s: &fmt::Display) -> Result<String> {
+pub fn uppercase(s: &dyn fmt::Display) -> Result<String> {
     upper(s)
 }
 
 /// Strip leading and trailing whitespace
-pub fn trim(s: &fmt::Display) -> Result<String> {
+pub fn trim(s: &dyn fmt::Display) -> Result<String> {
     let s = s.to_string();
     Ok(s.trim().to_owned())
 }
 
 /// Limit string length, appends '...' if truncated
-pub fn truncate(s: &fmt::Display, len: &usize) -> Result<String> {
+pub fn truncate(s: &dyn fmt::Display, len: &usize) -> Result<String> {
     let mut s = s.to_string();
     if s.len() < *len {
         Ok(s)
@@ -151,7 +151,7 @@ pub fn truncate(s: &fmt::Display, len: &usize) -> Result<String> {
 }
 
 /// Indent lines with `width` spaces
-pub fn indent(s: &fmt::Display, width: &usize) -> Result<String> {
+pub fn indent(s: &dyn fmt::Display, width: &usize) -> Result<String> {
     let s = s.to_string();
 
     let mut indented = String::new();
@@ -216,7 +216,7 @@ where
 }
 
 /// Capitalize a value. The first character will be uppercase, all others lowercase.
-pub fn capitalize(s: &fmt::Display) -> Result<String> {
+pub fn capitalize(s: &dyn fmt::Display) -> Result<String> {
     let mut s = s.to_string();
 
     match s.get_mut(0..1).map(|s| {
@@ -234,7 +234,7 @@ pub fn capitalize(s: &fmt::Display) -> Result<String> {
 }
 
 /// Centers the value in a field of a given width
-pub fn center(s: &fmt::Display, l: usize) -> Result<String> {
+pub fn center(s: &dyn fmt::Display, l: usize) -> Result<String> {
     let s = s.to_string();
     let len = s.len();
 
@@ -261,7 +261,7 @@ pub fn center(s: &fmt::Display, l: usize) -> Result<String> {
 }
 
 /// Count the words in that string
-pub fn wordcount(s: &fmt::Display) -> Result<usize> {
+pub fn wordcount(s: &dyn fmt::Display) -> Result<usize> {
     let s = s.to_string();
 
     Ok(s.split_whitespace().count())
diff --git a/askama_shared/src/lib.rs b/askama_shared/src/lib.rs
index 07967f4..850cb8b 100644
--- a/askama_shared/src/lib.rs
+++ b/askama_shared/src/lib.rs
@@ -1,14 +1,8 @@
 #![cfg_attr(feature = "cargo-clippy", allow(unused_parens))]
-
-extern crate askama_escape;
-extern crate humansize;
-extern crate num_traits;
-extern crate serde;
 #[macro_use]
 extern crate serde_derive;
-#[cfg(feature = "serde_json")]
-extern crate serde_json;
-extern crate toml;
+
+use toml;
 
 use std::env;
 use std::fs;
@@ -16,8 +10,8 @@ use std::path::{Path, PathBuf};
 
 mod error;
 
+pub use crate::error::{Error, Result};
 pub use askama_escape::MarkupDisplay;
-pub use error::{Error, Result};
 
 use std::collections::BTreeMap;
 
@@ -31,14 +25,14 @@ pub struct Config<'a> {
 }
 
 impl<'a> Config<'a> {
-    pub fn new(s: &str) -> Config {
+    pub fn new(s: &str) -> Config<'_> {
         let root = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
         let default_dirs = vec![root.join("templates")];
 
         let mut syntaxes = BTreeMap::new();
         syntaxes.insert(DEFAULT_SYNTAX_NAME.to_string(), Syntax::default());
 
-        let raw: RawConfig =
+        let raw: RawConfig<'_> =
             toml::from_str(&s).expect(&format!("invalid TOML in {}", CONFIG_FILE_NAME));
 
         let (dirs, default_syntax) = match raw.general {


Test patch:
diff --git a/testing/Cargo.toml b/testing/Cargo.toml
index 15cbfe2..16d2f34 100644
--- a/testing/Cargo.toml
+++ b/testing/Cargo.toml
@@ -3,13 +3,14 @@ name = "askama_testing"
 version = "0.1.0"
 authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
 workspace = ".."
+edition = "2018"
 
 [features]
 actix = ["actix-web", "bytes", "askama/with-actix-web"]
 default = []
 full = ["actix", "with-iron", "serde-json"]
 serde-json = ["serde_json", "askama/serde-json"]
-with-rocket = ["rocket", "rocket_codegen", "askama/with-rocket"]
+with-rocket = ["rocket", "askama/with-rocket"]
 with-iron = ["iron", "askama/with-iron"]
 
 [dependencies]
@@ -17,8 +18,7 @@ actix-web = { version = "0.7", optional = true }
 askama = { path = "../askama", version = "*" }
 bytes = { version = "0.4", optional = true }
 iron = { version = "0.6", optional = true }
-rocket = { version = "0.3", optional = true }
-rocket_codegen = { version = "0.3", optional = true }
+rocket = { version = "0.4", optional = true }
 serde_json = { version = "1.0", optional = true }
 
 [build-dependencies]
diff --git a/testing/benches/all.rs b/testing/benches/all.rs
index ff9d248..3ce0812 100644
--- a/testing/benches/all.rs
+++ b/testing/benches/all.rs
@@ -1,4 +1,3 @@
-extern crate askama;
 #[macro_use]
 extern crate criterion;
 
diff --git a/testing/build.rs b/testing/build.rs
index 89e3e6b..aab2d59 100644
--- a/testing/build.rs
+++ b/testing/build.rs
@@ -1,4 +1,4 @@
-extern crate askama;
+use askama;
 
 fn main() {
     askama::rerun_if_templates_changed();
diff --git a/testing/tests/actix_web.rs b/testing/tests/actix_web.rs
index e2d8bcf..d40830f 100644
--- a/testing/tests/actix_web.rs
+++ b/testing/tests/actix_web.rs
@@ -1,9 +1,4 @@
 #![cfg(feature = "actix")]
-#[macro_use]
-extern crate askama;
-extern crate actix_web;
-extern crate bytes;
-
 use actix_web::http::header::CONTENT_TYPE;
 use actix_web::test;
 use actix_web::HttpMessage;
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
index 0e48b05..4579afe 100644
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -1,5 +1,3 @@
-#[macro_use]
-extern crate askama;
 #[cfg(feature = "serde-json")]
 #[macro_use]
 extern crate serde_json;
@@ -49,7 +47,7 @@ mod filters {
         Ok(s.replace("oo", "aa").to_string())
     }
     // for test_nested_filter_ref
-    pub fn mytrim(s: &::std::fmt::Display) -> ::askama::Result<String> {
+    pub fn mytrim(s: &dyn (::std::fmt::Display)) -> ::askama::Result<String> {
         let s = format!("{}", s);
         Ok(s.trim().to_owned())
     }
diff --git a/testing/tests/hello.rs b/testing/tests/hello.rs
index 09a2e22..bfb71b1 100644
--- a/testing/tests/hello.rs
+++ b/testing/tests/hello.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)] // this will generate the code...
diff --git a/testing/tests/include.rs b/testing/tests/include.rs
index f0158d7..f461a7b 100644
--- a/testing/tests/include.rs
+++ b/testing/tests/include.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs
index 8c07c4e..35fee80 100644
--- a/testing/tests/inheritance.rs
+++ b/testing/tests/inheritance.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/iron.rs b/testing/tests/iron.rs
index 10dcee3..f58a609 100644
--- a/testing/tests/iron.rs
+++ b/testing/tests/iron.rs
@@ -1,8 +1,4 @@
 #![cfg(feature = "iron")]
-#[macro_use]
-extern crate askama;
-extern crate iron;
-
 use askama::Template;
 use iron::{status, Response};
 
diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs
index a0736f5..3dfad38 100644
--- a/testing/tests/loops.rs
+++ b/testing/tests/loops.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/macro.rs b/testing/tests/macro.rs
index 77e0e59..51fbcdc 100644
--- a/testing/tests/macro.rs
+++ b/testing/tests/macro.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs
index 9ea1d72..89082ef 100644
--- a/testing/tests/matches.rs
+++ b/testing/tests/matches.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/methods.rs b/testing/tests/methods.rs
index d1e391f..d24000e 100644
--- a/testing/tests/methods.rs
+++ b/testing/tests/methods.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs
index 5e23dff..d6c3cae 100644
--- a/testing/tests/operators.rs
+++ b/testing/tests/operators.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]
diff --git a/testing/tests/rocket.rs b/testing/tests/rocket.rs
index 2bf4713..3dbc357 100644
--- a/testing/tests/rocket.rs
+++ b/testing/tests/rocket.rs
@@ -1,9 +1,7 @@
 #![cfg(feature = "with-rocket")]
-#![feature(plugin)]
-#![plugin(rocket_codegen)]
+#![feature(proc_macro_hygiene, decl_macro)]
 
 #[macro_use]
-extern crate askama;
 extern crate rocket;
 
 use askama::Template;
diff --git a/testing/tests/rust_macro.rs b/testing/tests/rust_macro.rs
index 90f1f3e..8a114f9 100644
--- a/testing/tests/rust_macro.rs
+++ b/testing/tests/rust_macro.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 macro_rules! hello {
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index 2cb404e..f192609 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 use std::collections::HashMap;
diff --git a/testing/tests/vars.rs b/testing/tests/vars.rs
index 81263da..87af3f6 100644
--- a/testing/tests/vars.rs
+++ b/testing/tests/vars.rs
@@ -1,6 +1,3 @@
-#[macro_use]
-extern crate askama;
-
 use askama::Template;
 
 #[derive(Template)]