Merge branch 'master' into stable

This commit is contained in:
Vince Pike 2023-04-13 13:53:46 -04:00
commit b3f227d2ad
14 changed files with 683 additions and 969 deletions

View File

@ -23,7 +23,7 @@ jobs:
toolchain: beta
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
toolchain: 1.42.0 # MSRV
toolchain: 1.60.0 # MSRV
- os: ubuntu-latest
deps: sudo apt update ; sudo apt install gcc-multilib
target: i686-unknown-linux-gnu

195
Cargo.lock generated
View File

@ -2,6 +2,21 @@
# It is not intended for manual editing.
version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "basic-toml"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c0de75129aa8d0cceaf750b89013f0e08804d6ec61416da787b35ad0d7cddf1"
dependencies = [
"serde",
]
[[package]]
name = "bitflags"
version = "1.3.2"
@ -21,7 +36,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096"
dependencies = [
"quote",
"syn",
"syn 1.0.109",
]
[[package]]
@ -32,9 +47,9 @@ checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8"
[[package]]
name = "filetime"
version = "0.2.19"
version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9"
checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98"
dependencies = [
"cfg-if",
"libc",
@ -44,9 +59,9 @@ dependencies = [
[[package]]
name = "glob"
version = "0.3.1"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "home"
@ -57,6 +72,16 @@ dependencies = [
"winapi",
]
[[package]]
name = "indexmap"
version = "1.9.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99"
dependencies = [
"autocfg",
"hashbrown",
]
[[package]]
name = "integration-tests"
version = "0.6.0"
@ -71,9 +96,9 @@ dependencies = [
[[package]]
name = "itoa"
version = "1.0.5"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
[[package]]
name = "itoap"
@ -83,9 +108,9 @@ checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8"
[[package]]
name = "libc"
version = "0.2.139"
version = "0.2.119"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"
[[package]]
name = "memchr"
@ -95,9 +120,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
[[package]]
name = "once_cell"
version = "1.17.0"
version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]]
name = "output_vt100"
@ -122,18 +147,18 @@ dependencies = [
[[package]]
name = "proc-macro2"
version = "1.0.50"
version = "1.0.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ef7d57beacfaf2d8aee5937dab7b7f28de3cb8b1828479bb5de2a7106f2bae2"
checksum = "c7342d5883fbccae1cc37a2353b09c87c9b0f3afd73f5fb9bba687a1f733b029"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.23"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145"
dependencies = [
"proc-macro2",
]
@ -149,9 +174,9 @@ dependencies = [
[[package]]
name = "ryu"
version = "1.0.12"
version = "1.0.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f"
[[package]]
name = "sailfish"
@ -176,7 +201,7 @@ dependencies = [
"proc-macro2",
"quote",
"serde",
"syn",
"syn 2.0.14",
"toml",
]
@ -190,29 +215,29 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.152"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.152"
version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [
"proc-macro2",
"quote",
"syn",
"syn 2.0.14",
]
[[package]]
name = "serde_json"
version = "1.0.91"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
dependencies = [
"itoa",
"ryu",
@ -220,10 +245,30 @@ dependencies = [
]
[[package]]
name = "syn"
version = "1.0.107"
name = "serde_spanned"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4"
dependencies = [
"serde",
]
[[package]]
name = "syn"
version = "1.0.109"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "syn"
version = "1.0.86"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b"
dependencies = [
"proc-macro2",
"quote",
@ -241,33 +286,46 @@ dependencies = [
[[package]]
name = "toml"
version = "0.5.11"
version = "0.5.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
dependencies = [
"serde",
]
[[package]]
name = "trybuild"
version = "1.0.76"
name = "toml_edit"
version = "0.19.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6ed2c57956f91546d4d33614265a85d55c8e1ab91484853a10335894786d7db6"
checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13"
dependencies = [
"indexmap",
"serde",
"serde_spanned",
"toml_datetime",
"winnow",
]
[[package]]
name = "trybuild"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2d60539445867cdd9680b2bfe2d0428f1814b7d5c9652f09d8d3eae9d19308db"
dependencies = [
"basic-toml",
"glob",
"once_cell",
"serde",
"serde_derive",
"serde_json",
"termcolor",
"toml",
]
[[package]]
name = "unicode-ident"
version = "1.0.6"
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "version_check"
@ -305,66 +363,3 @@ name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows-sys"
version = "0.42.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608"
[[package]]
name = "windows_aarch64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7"
[[package]]
name = "windows_i686_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640"
[[package]]
name = "windows_i686_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605"
[[package]]
name = "windows_x86_64_gnu"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463"
[[package]]
name = "windows_x86_64_msvc"
version = "0.42.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "yansi"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"

View File

@ -7,7 +7,7 @@ Simple, small, and extremely fast template engine for Rust
[![Tests](https://github.com/rust-sailfish/sailfish/workflows/Tests/badge.svg)](https://github.com/rust-sailfish/sailfish/actions?query=workflow%3ATests)
[![Version](https://img.shields.io/crates/v/sailfish)](https://crates.io/crates/sailfish)
[![dependency status](https://deps.rs/repo/github/rust-sailfish/sailfish/status.svg)](https://deps.rs/repo/github/rust-sailfish/sailfish)
[![Rust 1.42](https://img.shields.io/badge/rust-1.42+-lightgray.svg)](https://blog.rust-lang.org/2020/03/12/Rust-1.42.html)
[![Rust 1.60](https://img.shields.io/badge/rust-1.60+-lightgray.svg)](https://blog.rust-lang.org/2022/04/07/Rust-1.60.0.html)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/rust-sailfish/sailfish/blob/master/LICENSE)
[User Guide](https://rust-sailfish.github.io/sailfish/) | [API Docs](https://docs.rs/sailfish) | [Examples](./examples)
@ -23,7 +23,7 @@ Simple, small, and extremely fast template engine for Rust
- Extremely fast (See [benchmarks](https://github.com/djc/template-benchmarks-rs))
- Better error message
- Syntax highlighting support ([vscode](./syntax/vscode), [vim](./syntax/vim))
- Works on Rust 1.42 or later
- Works on Rust 1.60 or later
## 🐟 Example

View File

@ -17,7 +17,7 @@ There are many libraries for template rendering in Rust. Among those libraries,
## Upcoming features
Since sailfish is on early stage of development, there are many upcoming features that is not supported yet. You can find many [RFC](https://github.com/rust-sailfish/sailfish/issues?q=is%3Aissue+is%3Aopen+label%3A%22Type%3A+RFC%22)s in my repository. These RFC include:
Since sailfish is on early stage of development, there are many upcoming features that is not supported yet. You can find many [RFC](https://github.com/rust-sailfish/sailfish/issues?q=is%3Aissue+is%3Aopen+label%3A%22Status%3A+RFC%22)s in my repository. These RFC include:
- `Template` trait (which does not consume itself)
- Template inheritance (block, partials, etc.)

1269
examples/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -6,8 +6,8 @@ edition = "2018"
publish = false
[dependencies]
actix-web = { version = "2.0.0", default-features = false }
actix-rt = "1.1.1"
actix-web = { version = "4.3.1", default-features = false }
actix-rt = "2.8.0"
sailfish = { path = "../sailfish" }
sailfish-macros = { path = "../sailfish-macros" }

View File

@ -22,15 +22,15 @@ procmacro = []
config = ["serde", "toml"]
[dependencies]
memchr = "2.3.3"
quote = { version = "1.0.6", default-features = false }
memchr = "2.5.0"
quote = { version = "1.0.26", default-features = false }
serde = { version = "1.0", features = ["derive"], optional = true }
toml = { version = "0.5", optional = true }
home = "0.5.3"
filetime = "0.2.14"
toml = { version = "0.7.3", optional = true }
home = "0.5.4"
filetime = "0.2.21"
[dependencies.syn]
version = "1.0.21"
version = "2.0"
default-features = false
features = ["parsing", "full", "visit-mut", "printing"]
@ -40,4 +40,4 @@ default-features = false
features = ["span-locations"]
[dev-dependencies]
pretty_assertions = "1.1.0"
pretty_assertions = "1.3.0"

View File

@ -1,7 +1,11 @@
use proc_macro2::TokenStream;
use quote::quote;
use syn::parse::{Parse, ParseStream, Result as ParseResult};
use syn::visit_mut::VisitMut;
use syn::{Block, Expr, ExprBreak, ExprContinue, ExprMacro, Ident, LitStr, Stmt, Token};
use syn::{
Block, Expr, ExprBreak, ExprContinue, ExprMacro, Ident, LitStr, Macro, Stmt,
StmtMacro, Token,
};
pub struct Optimizer {
rm_whitespace: bool,
@ -44,8 +48,7 @@ impl VisitMut for OptmizerImpl {
// check if statement is for loop
let fl = match stmt {
Stmt::Expr(Expr::ForLoop(ref mut fl))
| Stmt::Semi(Expr::ForLoop(ref mut fl), _) => fl,
Stmt::Expr(Expr::ForLoop(ref mut fl), _) => fl,
_ => {
results.push(stmt);
continue;
@ -116,35 +119,29 @@ impl VisitMut for OptmizerImpl {
i.stmts = results;
}
fn visit_stmt_macro_mut(&mut self, i: &mut StmtMacro) {
if self.rm_whitespace {
if let Some(v) = get_rendertext_value(&i.mac) {
let ts = match remove_whitespace(v) {
Some(value) => value,
None => return,
};
i.mac.tokens = ts;
return;
}
}
syn::visit_mut::visit_stmt_macro_mut(self, i);
}
fn visit_expr_macro_mut(&mut self, i: &mut ExprMacro) {
if self.rm_whitespace {
if let Some(v) = get_rendertext_value(i) {
let mut buffer = String::new();
let mut it = v.lines().peekable();
if let Some(line) = it.next() {
if it.peek().is_some() {
buffer.push_str(line.trim_end());
buffer.push('\n');
} else {
return;
}
}
while let Some(line) = it.next() {
if it.peek().is_some() {
if !line.is_empty() {
buffer.push_str(line.trim());
buffer.push('\n');
} else {
// ignore empty line
}
} else {
// last line
buffer.push_str(line.trim_start());
}
}
i.mac.tokens = quote! { __sf_buf, #buffer };
if let Some(v) = get_rendertext_value(&i.mac) {
let ts = match remove_whitespace(v) {
Some(value) => value,
None => return,
};
i.mac.tokens = ts;
return;
}
}
@ -153,7 +150,35 @@ impl VisitMut for OptmizerImpl {
}
}
fn get_rendertext_value(i: &ExprMacro) -> Option<String> {
fn remove_whitespace(v: String) -> Option<TokenStream> {
let mut buffer = String::new();
let mut it = v.lines().peekable();
if let Some(line) = it.next() {
if it.peek().is_some() {
buffer.push_str(line.trim_end());
buffer.push('\n');
} else {
return None;
}
}
while let Some(line) = it.next() {
if it.peek().is_some() {
if !line.is_empty() {
buffer.push_str(line.trim());
buffer.push('\n');
} else {
// ignore empty line
}
} else {
// last line
buffer.push_str(line.trim_start());
}
}
Some(quote! { __sf_buf, #buffer })
}
fn get_rendertext_value(mac: &Macro) -> Option<String> {
struct RenderTextMacroArgument {
#[allow(dead_code)]
context: Ident,
@ -170,13 +195,13 @@ fn get_rendertext_value(i: &ExprMacro) -> Option<String> {
}
}
let mut it = i.mac.path.segments.iter();
let mut it = mac.path.segments.iter();
if it.next().map_or(false, |s| s.ident == "__sf_rt")
&& it.next().map_or(false, |s| s.ident == "render_text")
&& it.next().is_none()
{
let tokens = i.mac.tokens.clone();
let tokens = mac.tokens.clone();
if let Ok(macro_arg) = syn::parse2::<RenderTextMacroArgument>(tokens) {
return Some(macro_arg.arg.value());
}
@ -186,12 +211,12 @@ fn get_rendertext_value(i: &ExprMacro) -> Option<String> {
}
fn get_rendertext_value_from_stmt(stmt: &Stmt) -> Option<String> {
let mac = match stmt {
Stmt::Semi(Expr::Macro(ref mac), ..) => mac,
let em = match stmt {
Stmt::Expr(Expr::Macro(ref mac), Some(_)) => mac,
_ => return None,
};
get_rendertext_value(mac)
get_rendertext_value(&em.mac)
}
fn block_has_continue_or_break(i: &mut Block) -> bool {

View File

@ -24,10 +24,7 @@ struct DeriveTemplateOptions {
impl DeriveTemplateOptions {
fn parser<'s>(&'s mut self) -> impl Parser + 's {
move |outer: ParseStream| -> ParseResult<()> {
let s;
syn::parenthesized!(s in outer);
move |s: ParseStream| -> ParseResult<()> {
while !s.is_empty() {
let key = s.parse::<Ident>()?;
s.parse::<Token![=]>()?;
@ -161,8 +158,8 @@ fn derive_template_impl(tokens: TokenStream) -> Result<TokenStream, syn::Error>
let mut all_options = DeriveTemplateOptions::default();
for attr in strct.attrs {
if attr.path.is_ident("template") {
syn::parse::Parser::parse2(all_options.parser(), attr.tokens)?;
if attr.path().is_ident("template") {
attr.parse_args_with(all_options.parser())?;
}
}
@ -271,6 +268,7 @@ fn derive_template_impl(tokens: TokenStream) -> Result<TokenStream, syn::Error>
}
fn render_once_to(self, __sf_buf: &mut sailfish::runtime::Buffer) -> std::result::Result<(), sailfish::runtime::RenderError> {
// This line is required for cargo to track child templates
#include_bytes_seq;
use sailfish::runtime as __sf_rt;

View File

@ -2,7 +2,7 @@ use quote::quote;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use syn::visit_mut::VisitMut;
use syn::{Block, Expr, ExprBlock, ExprMacro, LitStr};
use syn::{Block, Expr, ExprBlock, LitStr, Macro, Stmt};
use crate::error::*;
@ -82,8 +82,8 @@ struct ResolverImpl<'h> {
}
impl<'h> ResolverImpl<'h> {
fn resolve_include(&mut self, i: &ExprMacro) -> Result<Expr, Error> {
let arg = match syn::parse2::<LitStr>(i.mac.tokens.clone()) {
fn resolve_include(&mut self, mac: &Macro) -> Result<Expr, Error> {
let arg = match syn::parse2::<LitStr>(mac.tokens.clone()) {
Ok(l) => l.value(),
Err(e) => {
let mut e = Error::from(e);
@ -145,6 +145,24 @@ impl<'h> ResolverImpl<'h> {
}
impl<'h> VisitMut for ResolverImpl<'h> {
fn visit_stmt_mut(&mut self, i: &mut Stmt) {
return_if_some!(self.error);
let sm = matches_or_else!(*i, Stmt::Macro(ref mut sm), sm, {
syn::visit_mut::visit_stmt_mut(self, i);
return;
});
if sm.mac.path.is_ident("include") {
match self.resolve_include(&sm.mac) {
Ok(e) => *i = Stmt::Expr(e, None),
Err(e) => {
self.error = Some(e);
return;
}
}
}
}
fn visit_expr_mut(&mut self, i: &mut Expr) {
return_if_some!(self.error);
let em = matches_or_else!(*i, Expr::Macro(ref mut em), em, {
@ -154,7 +172,7 @@ impl<'h> VisitMut for ResolverImpl<'h> {
// resolve `include`
if em.mac.path.is_ident("include") {
match self.resolve_include(em) {
match self.resolve_include(&em.mac) {
Ok(e) => *i = e,
Err(e) => {
self.error = Some(e);

View File

@ -1,7 +1,6 @@
use proc_macro2::Span;
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use syn::parse::{Parse, ParseStream as SynParseStream, Result as ParseResult};
use syn::spanned::Spanned;
use syn::{BinOp, Block, Expr};
use crate::error::*;
@ -276,11 +275,11 @@ enum Filter {
Call(syn::ExprCall),
}
impl Spanned for Filter {
fn span(&self) -> Span {
match *self {
Filter::Ident(ref i) => i.span(),
Filter::Call(ref c) => c.span(),
impl ToTokens for Filter {
fn to_tokens(&self, tokens: &mut TokenStream) {
match self {
Filter::Ident(ident) => ident.to_tokens(tokens),
Filter::Call(call) => call.to_tokens(tokens),
}
}
}

View File

@ -26,7 +26,7 @@ default = ["config"]
config = ["sailfish-compiler/config"]
[dependencies]
proc-macro2 = "1.0.11"
proc-macro2 = "1.0.56"
[dependencies.sailfish-compiler]
path = "../sailfish-compiler"

View File

@ -9,8 +9,8 @@ publish = false
sailfish = { path = "../../sailfish", default-features = false, features = ["json"] }
sailfish-macros = { path = "../../sailfish-macros" }
sailfish-compiler = { path = "../../sailfish-compiler" }
serde_json = "1.0.53"
serde_json = "1.0.95"
[dev-dependencies]
trybuild = "1.0.28"
pretty_assertions = "1.1.0"
trybuild = "1.0.80"
pretty_assertions = "1.3.0"

View File

@ -23,9 +23,9 @@ perf-inline = []
[dependencies]
itoap = "1.0.1"
ryu = "1.0.4"
serde = { version = "1.0.111", optional = true }
serde_json = { version = "1.0.53", optional = true }
ryu = "1.0.13"
serde = { version = "1.0.159", optional = true }
serde_json = { version = "1.0.95", optional = true }
[dependencies.sailfish-macros]
path = "../sailfish-macros"
@ -33,7 +33,7 @@ version = "0.6.0"
optional = true
[build-dependencies]
version_check = "0.9.2"
version_check = "0.9.4"
[package.metadata.docs.rs]
all-features = true