Skip to content

Commit e5223e9

Browse files
committed
Use pull request #165 from @r-ml Thank you! This has been tested by myself, and a couple projects. Also cleaned up a few warnings.
1 parent 89d4fd0 commit e5223e9

File tree

27 files changed

+250
-198
lines changed

27 files changed

+250
-198
lines changed

Cargo.lock

Lines changed: 171 additions & 128 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ members = [
88
exclude = [
99
"examples"
1010
]
11+
resolver = "2"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Dependencies:
2727

2828
```toml
2929
[dependencies]
30-
sailfish = "0.9.0"
30+
sailfish = "0.10.0"
3131
```
3232

3333
You can choose to use `TemplateSimple` to access fields directly:

docs/en/docs/installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ In order to use sailfish templates, you have add two dependencies in your `Cargo
44

55
``` toml
66
[dependencies]
7-
sailfish = "0.9.1"
7+
sailfish = "0.10.0"
88
```
99

1010
## Feature Flags

examples/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[package]
22
name = "sailfish-examples"
3-
version = "0.9.1"
3+
version = "0.10.0"
44
authors = ["Ryohei Machida <[email protected]>"]
5-
edition = "2018"
5+
edition = "2024"
66
publish = false
77

88
[dependencies]

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
max_width = 90
22
hard_tabs = false
33
use_field_init_shorthand = true
4-
edition = "2021"
4+
edition = "2024"
55
reorder_imports = true
66
reorder_modules = true

sailfish-compiler/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sailfish-compiler"
3-
version = "0.9.1"
3+
version = "0.10.0"
44
authors = ["Ryohei Machida <[email protected]>"]
55
description = "Simple, small, and extremely fast template engine for Rust"
66
homepage = "https://github.com/rust-sailfish/sailfish"
@@ -10,7 +10,7 @@ keywords = ["markup", "template", "html"]
1010
categories = ["template-engine"]
1111
license = "MIT"
1212
workspace = ".."
13-
edition = "2018"
13+
edition = "2024"
1414

1515
[lib]
1616
name = "sailfish_compiler"

sailfish-compiler/src/config.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,20 +193,23 @@ mod imp {
193193

194194
#[cfg(test)]
195195
mod tests {
196+
196197
use crate::config::imp::expand_env_vars;
197198
use std::env;
198199

199200
#[test]
201+
#[allow(unsafe_code)]
200202
fn expands_env_vars() {
201-
env::set_var("TESTVAR", "/a/path");
203+
unsafe { env::set_var("TESTVAR", "/a/path") };
202204
let input = "/path/to/${TESTVAR}Templates";
203205
let output = expand_env_vars(input).unwrap();
204206
assert_eq!(output, "/path/to//a/pathTemplates");
205207
}
206208

207209
#[test]
210+
#[allow(unsafe_code)]
208211
fn retains_case_sensitivity() {
209-
env::set_var("tEstVar", "/a/path");
212+
unsafe { env::set_var("tEstVar", "/a/path") };
210213
let input = "/path/${tEstVar}";
211214
let output = expand_env_vars(input).unwrap();
212215
assert_eq!(output, "/path//a/path");

sailfish-compiler/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![forbid(unsafe_code)]
1+
#![cfg_attr(not(test), forbid(unsafe_code))]
22

33
#[macro_use]
44
mod error;

sailfish-compiler/src/optimizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ fn get_rendertext_value(mac: &Macro) -> Option<String> {
237237

238238
fn get_rendertext_value_from_stmt(stmt: &Stmt) -> Option<String> {
239239
let em = match stmt {
240-
Stmt::Expr(Expr::Macro(ref mac), Some(_)) => mac,
240+
Stmt::Expr(Expr::Macro(mac), Some(_)) => mac,
241241
_ => return None,
242242
};
243243

0 commit comments

Comments
 (0)