Rust 2018

This commit is contained in:
Chris Wong 2019-03-16 20:13:16 +13:00
parent 65874efb98
commit 39f543c819
13 changed files with 14 additions and 30 deletions

View file

@ -1,16 +1,15 @@
[package]
name = "maud"
# When releasing a new version, please update html_root_url in src/lib.rs
version = "0.20.0"
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
license = "MIT/Apache-2.0"
documentation = "https://docs.rs/maud/"
homepage = "https://maud.lambda.xyz/"
repository = "https://github.com/lfairy/maud"
description = "Compile-time HTML templates."
categories = ["template-engine"]
edition = "2018"
[dependencies]
maud_htmlescape = { version = "0.17.0", path = "../maud_htmlescape" }

View file

@ -13,9 +13,6 @@
#[cfg(feature = "iron")] extern crate iron;
#[cfg(feature = "rocket")] extern crate rocket;
extern crate maud_htmlescape;
extern crate maud_macros;
use std::fmt::{self, Write};
pub use maud_macros::{html, html_debug};
@ -159,7 +156,7 @@ mod iron_support {
use iron::modifier::{Modifier, Set};
use iron::modifiers::Header;
use iron::response::{Response, WriteBody};
use PreEscaped;
use crate::PreEscaped;
impl Modifier<Response> for PreEscaped<String> {
fn modify(self, response: &mut Response) {
@ -182,7 +179,7 @@ mod rocket_support {
use rocket::request::Request;
use rocket::response::{Responder, Response};
use std::io::Cursor;
use PreEscaped;
use crate::PreEscaped;
impl Responder<'static> for PreEscaped<String> {
fn respond_to(self, _: &Request) -> Result<Response<'static>, Status> {
@ -196,7 +193,7 @@ mod rocket_support {
#[cfg(feature = "actix-web")]
mod actix_support {
use PreEscaped;
use crate::PreEscaped;
use actix_web::{Responder, HttpResponse, HttpRequest, Error};
impl Responder for PreEscaped<String> {

View file

@ -1,7 +1,5 @@
#![feature(proc_macro_hygiene)]
extern crate maud;
use maud::{Markup, html};
#[test]

View file

@ -1,7 +1,5 @@
#![feature(proc_macro_hygiene)]
extern crate maud;
use maud::html;
#[test]
@ -194,7 +192,7 @@ fn let_lexical_scope() {
#[test]
fn let_type_ascription() {
let s = html! {
@let mut x: Box<Iterator<Item=u32>> = Box::new(vec![42].into_iter());
@let mut x: Box<dyn Iterator<Item=u32>> = Box::new(vec![42].into_iter());
"I have " (x.next().unwrap()) " cupcakes!"
}.into_string();
assert_eq!(s, "I have 42 cupcakes!");

View file

@ -1,8 +1,6 @@
#![feature(proc_macro_hygiene)]
extern crate maud;
use maud::html;
use maud::{self, html};
#[test]
fn issue_13() {

View file

@ -1,7 +1,5 @@
#![feature(proc_macro_hygiene)]
extern crate maud;
use maud::html;
#[test]

View file

@ -1,4 +1,4 @@
extern crate compiletest_rs;
use compiletest_rs;
use std::path::PathBuf;

View file

@ -1,15 +1,14 @@
[package]
name = "maud_htmlescape"
# When releasing a new version, please update html_root_url in lib.rs
version = "0.17.0"
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
license = "MIT/Apache-2.0"
documentation = "https://docs.rs/maud_htmlescape/"
homepage = "https://maud.lambda.xyz/"
repository = "https://github.com/lfairy/maud"
description = "Internal support code used by Maud."
edition = "2018"
[lib]
path = "lib.rs"

View file

@ -57,7 +57,7 @@ impl<'a> fmt::Write for Escaper<'a> {
#[cfg(test)]
mod test {
use std::fmt::Write;
use Escaper;
use crate::Escaper;
#[test]
fn it_works() {

View file

@ -1,15 +1,14 @@
[package]
name = "maud_macros"
# When releasing a new version, please update html_root_url in src/lib.rs
version = "0.20.0"
authors = ["Chris Wong <lambda.fairy@gmail.com>"]
license = "MIT/Apache-2.0"
documentation = "https://docs.rs/maud_macros/"
homepage = "https://maud.lambda.xyz/"
repository = "https://github.com/lfairy/maud"
description = "Compile-time HTML templates."
edition = "2018"
[dependencies]
literalext = { version = "0.1", default-features = false, features = ["proc-macro"] }

View file

@ -1,3 +1,4 @@
use matches::matches;
use maud_htmlescape::Escaper;
use proc_macro::{
Delimiter,
@ -10,7 +11,7 @@ use proc_macro::{
TokenTree,
};
use ast::*;
use crate::ast::*;
pub fn generate(markups: Vec<Markup>, output_ident: TokenTree) -> TokenStream {
let mut build = Builder::new(output_ident.clone());

View file

@ -10,9 +10,6 @@
// lifetimes outweighs the marginal gains from explicit borrowing
#![allow(clippy::needless_pass_by_value)]
extern crate literalext;
#[macro_use] extern crate matches;
extern crate maud_htmlescape;
extern crate proc_macro;
mod ast;

View file

@ -11,8 +11,8 @@ use std::mem;
use literalext::LiteralExt;
use ast;
use ParseResult;
use crate::ast;
use crate::ParseResult;
pub fn parse(input: TokenStream) -> ParseResult<Vec<ast::Markup>> {
Parser::new(input).markups()