Upgrade to 2018 edition

This commit is contained in:
Dirkjan Ochtman 2018-12-07 15:41:35 +01:00 committed by Juan Aguilar
parent cf8dc532f0
commit d042c5d758
12 changed files with 22 additions and 17 deletions

View File

@ -11,6 +11,7 @@ repository = "https://github.com/djc/askama"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
workspace = ".." workspace = ".."
readme = "../README.md" readme = "../README.md"
edition = "2018"
[badges] [badges]
appveyor = { repository = "djc/askama" } appveyor = { repository = "djc/askama" }

View File

@ -422,9 +422,9 @@ pub trait Template {
Self: Sized; Self: Sized;
} }
pub use crate::shared::filters;
pub use crate::shared::{read_config_file, Error, MarkupDisplay, Result};
pub use askama_derive::*; pub use askama_derive::*;
pub use shared::filters;
pub use shared::{read_config_file, Error, MarkupDisplay, Result};
#[cfg(feature = "with-iron")] #[cfg(feature = "with-iron")]
pub mod iron { pub mod iron {

View File

@ -7,6 +7,7 @@ homepage = "https://github.com/djc/askama"
repository = "https://github.com/djc/askama" repository = "https://github.com/djc/askama"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
workspace = ".." workspace = ".."
edition = "2018"
[lib] [lib]
proc-macro = true proc-macro = true

View File

@ -1,7 +1,7 @@
use super::{get_template_source, Context, Heritage}; use super::{get_template_source, Context, Heritage};
use input::TemplateInput; use crate::input::TemplateInput;
use parser::{Cond, Expr, MatchParameter, MatchVariant, Node, Target, When, WS}; use crate::parser::{Cond, Expr, MatchParameter, MatchVariant, Node, Target, When, WS};
use shared::filters; use crate::shared::filters;
use proc_macro2::Span; use proc_macro2::Span;
@ -13,7 +13,7 @@ use std::{cmp, hash, mem, str};
use syn; use syn;
use parser::parse; use crate::parser::parse;
pub(crate) fn generate( pub(crate) fn generate(
input: &TemplateInput, input: &TemplateInput,

View File

@ -2,7 +2,7 @@ use proc_macro2::TokenStream;
use quote::ToTokens; use quote::ToTokens;
use shared::{Config, Syntax}; use crate::shared::{Config, Syntax};
use std::path::PathBuf; use std::path::PathBuf;

View File

@ -11,12 +11,12 @@ mod generator;
mod input; mod input;
mod parser; mod parser;
use input::{Print, Source, TemplateInput}; use crate::input::{Print, Source, TemplateInput};
use parser::{Expr, Macro, Node}; use crate::parser::{Expr, Macro, Node};
use crate::shared::{read_config_file, Config};
use proc_macro::TokenStream; use proc_macro::TokenStream;
use shared::{read_config_file, Config};
use parser::parse; use crate::parser::parse;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs; use std::fs;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@ -220,7 +220,7 @@ fn get_template_source(tpl_path: &Path) -> String {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::get_template_source; use super::get_template_source;
use Config; use crate::Config;
#[test] #[test]
fn get_source() { fn get_source() {

View File

@ -4,7 +4,7 @@
use nom; use nom;
use std::str; use std::str;
use shared::Syntax; use crate::shared::Syntax;
#[derive(Debug)] #[derive(Debug)]
pub enum Expr<'a> { pub enum Expr<'a> {
@ -123,7 +123,7 @@ fn take_content<'a>(
i: Input<'a>, i: Input<'a>,
s: &'a Syntax<'a>, s: &'a Syntax<'a>,
) -> Result<(Input<'a>, Node<'a>), nom::Err<Input<'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 bs = s.block_start.as_bytes()[0];
let be = s.block_start.as_bytes()[1]; let be = s.block_start.as_bytes()[1];
let cs = s.comment_start.as_bytes()[0]; 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)] #[cfg(test)]
mod tests { mod tests {
use shared::Syntax; use crate::shared::Syntax;
fn check_ws_split(s: &str, res: &(&str, &str, &str)) { fn check_ws_split(s: &str, res: &(&str, &str, &str)) {
let node = super::split_ws_parts(s.as_bytes()); let node = super::split_ws_parts(s.as_bytes());

View File

@ -9,6 +9,7 @@ homepage = "https://github.com/djc/askama"
repository = "https://github.com/djc/askama" repository = "https://github.com/djc/askama"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
workspace = ".." workspace = ".."
edition = "2018"
[badges] [badges]
appveyor = { repository = "djc/askama" } appveyor = { repository = "djc/askama" }

View File

@ -7,6 +7,7 @@ homepage = "https://github.com/djc/askama"
repository = "https://github.com/djc/askama" repository = "https://github.com/djc/askama"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
workspace = ".." workspace = ".."
edition = "2018"
[dependencies] [dependencies]
askama_escape = { version = "0.1.0", path = "../askama_escape" } askama_escape = { version = "0.1.0", path = "../askama_escape" }

View File

@ -10,8 +10,8 @@ mod json;
#[cfg(feature = "serde_json")] #[cfg(feature = "serde_json")]
pub use self::json::json; pub use self::json::json;
use crate::error::Error::Fmt;
use askama_escape::MarkupDisplay; use askama_escape::MarkupDisplay;
use error::Error::Fmt;
use humansize::{file_size_opts, FileSize}; use humansize::{file_size_opts, FileSize};
use num_traits::cast::NumCast; use num_traits::cast::NumCast;
use num_traits::Signed; use num_traits::Signed;

View File

@ -16,8 +16,8 @@ use std::path::{Path, PathBuf};
mod error; mod error;
pub use crate::error::{Error, Result};
pub use askama_escape::MarkupDisplay; pub use askama_escape::MarkupDisplay;
pub use error::{Error, Result};
use std::collections::BTreeMap; use std::collections::BTreeMap;

View File

@ -3,6 +3,7 @@ name = "askama_testing"
version = "0.1.0" version = "0.1.0"
authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"] authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"]
workspace = ".." workspace = ".."
edition = "2018"
[features] [features]
actix = ["actix-web", "bytes", "askama/with-actix-web"] actix = ["actix-web", "bytes", "askama/with-actix-web"]