Update to Rust 2021 ()

This commit is contained in:
Chris Wong 2021-11-01 17:18:48 +11:00 committed by GitHub
parent 0106dfd909
commit 49755007da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 30 deletions

View file

@ -6,6 +6,8 @@
[#303](https://github.com/lambda-fairy/maud/pull/303) [#303](https://github.com/lambda-fairy/maud/pull/303)
- Add support for `Option<T>` attributes using the `attr=[value]` syntax. - Add support for `Option<T>` attributes using the `attr=[value]` syntax.
[#306](https://github.com/lambda-fairy/maud/pull/306) [#306](https://github.com/lambda-fairy/maud/pull/306)
- Update to Rust 2021
[#309](https://github.com/lambda-fairy/maud/pull/309)
## [0.22.3] - 2021-09-27 ## [0.22.3] - 2021-09-27

View file

@ -160,6 +160,24 @@ html! {
# ; # ;
``` ```
In Rust 2021,
the `#` symbol must be preceded by a space,
to avoid conflicts with [reserved syntax]:
[reserved syntax]: https://doc.rust-lang.org/edition-guide/rust-2021/reserving-syntax.html
```rust,edition2018
# let _ = maud::
html! {
// Works on all Rust editions
input #pinkie;
// Works on Rust 2018 and older only
input#pinkie;
}
# ;
```
The classes and IDs can be quoted. The classes and IDs can be quoted.
This is useful for names with numbers or symbols This is useful for names with numbers or symbols
which otherwise wouldn't parse: which otherwise wouldn't parse:

View file

@ -9,7 +9,7 @@ homepage = "https://maud.lambda.xyz/"
repository = "https://github.com/lambda-fairy/maud" repository = "https://github.com/lambda-fairy/maud"
description = "Compile-time HTML templates." description = "Compile-time HTML templates."
categories = ["template-engine"] categories = ["template-engine"]
edition = "2018" edition = "2021"
[features] [features]
default = [] default = []

View file

@ -197,7 +197,7 @@ fn class_shorthand() {
} }
#[test] #[test]
fn class_shorthand_with_space() { fn class_shorthand_without_space() {
let result = html! { p { "Hi, " span.name { "Lyra" } "!" } }; let result = html! { p { "Hi, " span.name { "Lyra" } "!" } };
assert_eq!( assert_eq!(
result.into_string(), result.into_string(),

View file

@ -8,7 +8,7 @@ documentation = "https://docs.rs/maud_htmlescape/"
homepage = "https://maud.lambda.xyz/" homepage = "https://maud.lambda.xyz/"
repository = "https://github.com/lambda-fairy/maud" repository = "https://github.com/lambda-fairy/maud"
description = "Internal support code used by Maud." description = "Internal support code used by Maud."
edition = "2018" edition = "2021"
[lib] [lib]
path = "lib.rs" path = "lib.rs"

View file

@ -8,7 +8,7 @@ documentation = "https://docs.rs/maud_macros/"
homepage = "https://maud.lambda.xyz/" homepage = "https://maud.lambda.xyz/"
repository = "https://github.com/lambda-fairy/maud" repository = "https://github.com/lambda-fairy/maud"
description = "Compile-time HTML templates." description = "Compile-time HTML templates."
edition = "2018" edition = "2021"
[dependencies] [dependencies]
syn = "1.0.8" syn = "1.0.8"