Skip to content

Commit

Permalink
Merge branch 'master' into fix/clippy-pedantic-warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kaj committed Jul 15, 2023
2 parents 9db94de + 8c279d5 commit 6ec519c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ project adheres to

## Unreleased

* Added a check that no more than one of the http-types, mime02, or
mime03 features are enabled (PR #124). Thanks @rustafarian-dev.
* Changed the writer type from `W: &mut Write` to just `W: Write` (PR #125).
Thanks @kornelski!
* Fixed more clippy lint (PR #123). Thanks @vbrandl!
* Updated `rsass` to 0.28.0 and `itertools` to 0.11.0.


## Release 0.16.1 -- 2023-01-28
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ tide013 = ["http-types"]
[dependencies]
base64 = "0.21.0"
bytecount = "0.6.0"
itertools = "0.10.0"
itertools = "0.11.0"
md5 = "0.7"
nom = "7.1.0"

rsass = { version = "0.27.0", optional = true }
rsass = { version = "0.28.0", optional = true }
mime = { version = "0.3", optional = true }

[badges]
Expand Down
9 changes: 9 additions & 0 deletions src/staticfiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,15 @@ fn name_and_ext(path: &Path) -> Option<(&str, &str)> {
None
}

#[cfg(any(
all(feature = "mime03", feature = "http-types"),
all(feature = "mime02", feature = "http-types"),
all(feature = "mime02", feature = "mime03"),
))]
compile_error!(
r#"Only one of these features "http-types", "mime02" or "mime03" must be enabled at a time."#
);

/// A short and url-safe checksum string from string data.
fn checksum_slug(data: &[u8]) -> String {
use base64::prelude::{Engine, BASE64_URL_SAFE_NO_PAD};
Expand Down
3 changes: 1 addition & 2 deletions src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ impl Template {
writeln!(
out,
"\n\
#[allow(clippy::used_underscore_binding)]\n\
pub fn {name}<{ta}{ta_sep}W>(_ructe_out_: &mut W{args}) -> io::Result<()>\n\
pub fn {name}<{ta}{ta_sep}W>(#[allow(unused_mut, clippy::used_underscore_binding)] mut _ructe_out_: W{args}) -> io::Result<()>\n\
where W: Write {{\n\
{body}\
Ok(())\n\
Expand Down
4 changes: 2 additions & 2 deletions src/templateexpression.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl TemplateExpression {
format!("_ructe_out_.write_all({text:?}.as_bytes())?;\n")
}
TemplateExpression::Expression { ref expr } => {
format!("{expr}.to_html(_ructe_out_)?;\n")
format!("{expr}.to_html(_ructe_out_.by_ref())?;\n")
}
TemplateExpression::ForLoop {
ref name,
Expand Down Expand Up @@ -122,7 +122,7 @@ impl TemplateExpression {
),
TemplateExpression::CallTemplate { ref name, ref args } => {
format!(
"{name}(_ructe_out_{})?;\n",
"{name}(_ructe_out_.by_ref(){})?;\n",
args.iter().format_with("", |arg, f| f(&format_args!(
", {arg}"
))),
Expand Down

0 comments on commit 6ec519c

Please sign in to comment.