aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-11-04 21:35:43 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2022-11-07 11:14:43 +0100
commitee4dbf0d8d7c81a3d77fa5b87a60152291e70fc7 (patch)
tree255bdc9dd115cc982571f912ed0e4401c2dce8bf
parent40b6f348d9e23ee1d2f7e4597a11bedb6325dc7e (diff)
downloadaskama-ee4dbf0d8d7c81a3d77fa5b87a60152291e70fc7.tar.gz
askama-ee4dbf0d8d7c81a3d77fa5b87a60152291e70fc7.tar.bz2
askama-ee4dbf0d8d7c81a3d77fa5b87a60152291e70fc7.zip
chore: apply clippy suggestions for 1.65
Diffstat (limited to '')
-rw-r--r--askama/src/filters/json.rs4
-rw-r--r--askama/src/filters/mod.rs120
-rw-r--r--askama/src/filters/yaml.rs4
-rw-r--r--askama/src/lib.rs2
-rw-r--r--askama_derive/src/config.rs2
-rw-r--r--testing/tests/filters.rs2
-rw-r--r--testing/tests/matches.rs2
-rw-r--r--testing/tests/operators.rs2
-rw-r--r--testing/tests/simple.rs2
9 files changed, 70 insertions, 70 deletions
diff --git a/askama/src/filters/json.rs b/askama/src/filters/json.rs
index e94e50c..03e624a 100644
--- a/askama/src/filters/json.rs
+++ b/askama/src/filters/json.rs
@@ -31,8 +31,8 @@ mod tests {
fn test_json() {
assert_eq!(json(true).unwrap(), "true");
assert_eq!(json("foo").unwrap(), r#""foo""#);
- assert_eq!(json(&true).unwrap(), "true");
- assert_eq!(json(&"foo").unwrap(), r#""foo""#);
+ assert_eq!(json(true).unwrap(), "true");
+ assert_eq!(json("foo").unwrap(), r#""foo""#);
assert_eq!(
json(&vec!["foo", "bar"]).unwrap(),
r#"[
diff --git a/askama/src/filters/mod.rs b/askama/src/filters/mod.rs
index 7312cd5..c581967 100644
--- a/askama/src/filters/mod.rs
+++ b/askama/src/filters/mod.rs
@@ -411,61 +411,61 @@ mod tests {
fn test_urlencoding() {
// Unreserved (https://tools.ietf.org/html/rfc3986.html#section-2.3)
// alpha / digit
- assert_eq!(urlencode(&"AZaz09").unwrap(), "AZaz09");
- assert_eq!(urlencode_strict(&"AZaz09").unwrap(), "AZaz09");
+ assert_eq!(urlencode("AZaz09").unwrap(), "AZaz09");
+ assert_eq!(urlencode_strict("AZaz09").unwrap(), "AZaz09");
// other
- assert_eq!(urlencode(&"_.-~").unwrap(), "_.-~");
- assert_eq!(urlencode_strict(&"_.-~").unwrap(), "_.-~");
+ assert_eq!(urlencode("_.-~").unwrap(), "_.-~");
+ assert_eq!(urlencode_strict("_.-~").unwrap(), "_.-~");
// Reserved (https://tools.ietf.org/html/rfc3986.html#section-2.2)
// gen-delims
- assert_eq!(urlencode(&":/?#[]@").unwrap(), "%3A/%3F%23%5B%5D%40");
+ assert_eq!(urlencode(":/?#[]@").unwrap(), "%3A/%3F%23%5B%5D%40");
assert_eq!(
- urlencode_strict(&":/?#[]@").unwrap(),
+ urlencode_strict(":/?#[]@").unwrap(),
"%3A%2F%3F%23%5B%5D%40"
);
// sub-delims
assert_eq!(
- urlencode(&"!$&'()*+,;=").unwrap(),
+ urlencode("!$&'()*+,;=").unwrap(),
"%21%24%26%27%28%29%2A%2B%2C%3B%3D"
);
assert_eq!(
- urlencode_strict(&"!$&'()*+,;=").unwrap(),
+ urlencode_strict("!$&'()*+,;=").unwrap(),
"%21%24%26%27%28%29%2A%2B%2C%3B%3D"
);
// Other
assert_eq!(
- urlencode(&"žŠďŤňĚáÉóŮ").unwrap(),
+ urlencode("žŠďŤňĚáÉóŮ").unwrap(),
"%C5%BE%C5%A0%C4%8F%C5%A4%C5%88%C4%9A%C3%A1%C3%89%C3%B3%C5%AE"
);
assert_eq!(
- urlencode_strict(&"žŠďŤňĚáÉóŮ").unwrap(),
+ urlencode_strict("žŠďŤňĚáÉóŮ").unwrap(),
"%C5%BE%C5%A0%C4%8F%C5%A4%C5%88%C4%9A%C3%A1%C3%89%C3%B3%C5%AE"
);
// Ferris
- assert_eq!(urlencode(&"🦀").unwrap(), "%F0%9F%A6%80");
- assert_eq!(urlencode_strict(&"🦀").unwrap(), "%F0%9F%A6%80");
+ assert_eq!(urlencode("🦀").unwrap(), "%F0%9F%A6%80");
+ assert_eq!(urlencode_strict("🦀").unwrap(), "%F0%9F%A6%80");
}
#[test]
fn test_linebreaks() {
assert_eq!(
- linebreaks(&"Foo\nBar Baz").unwrap(),
+ linebreaks("Foo\nBar Baz").unwrap(),
"<p>Foo<br/>Bar Baz</p>"
);
assert_eq!(
- linebreaks(&"Foo\nBar\n\nBaz").unwrap(),
+ linebreaks("Foo\nBar\n\nBaz").unwrap(),
"<p>Foo<br/>Bar</p><p>Baz</p>"
);
}
#[test]
fn test_linebreaksbr() {
- assert_eq!(linebreaksbr(&"Foo\nBar").unwrap(), "Foo<br/>Bar");
+ assert_eq!(linebreaksbr("Foo\nBar").unwrap(), "Foo<br/>Bar");
assert_eq!(
- linebreaksbr(&"Foo\nBar\n\nBaz").unwrap(),
+ linebreaksbr("Foo\nBar\n\nBaz").unwrap(),
"Foo<br/>Bar<br/><br/>Baz"
);
}
@@ -473,72 +473,72 @@ mod tests {
#[test]
fn test_paragraphbreaks() {
assert_eq!(
- paragraphbreaks(&"Foo\nBar Baz").unwrap(),
+ paragraphbreaks("Foo\nBar Baz").unwrap(),
"<p>Foo\nBar Baz</p>"
);
assert_eq!(
- paragraphbreaks(&"Foo\nBar\n\nBaz").unwrap(),
+ paragraphbreaks("Foo\nBar\n\nBaz").unwrap(),
"<p>Foo\nBar</p><p>Baz</p>"
);
assert_eq!(
- paragraphbreaks(&"Foo\n\n\n\n\nBar\n\nBaz").unwrap(),
+ paragraphbreaks("Foo\n\n\n\n\nBar\n\nBaz").unwrap(),
"<p>Foo</p><p>\nBar</p><p>Baz</p>"
);
}
#[test]
fn test_lower() {
- assert_eq!(lower(&"Foo").unwrap(), "foo");
- assert_eq!(lower(&"FOO").unwrap(), "foo");
- assert_eq!(lower(&"FooBar").unwrap(), "foobar");
- assert_eq!(lower(&"foo").unwrap(), "foo");
+ assert_eq!(lower("Foo").unwrap(), "foo");
+ assert_eq!(lower("FOO").unwrap(), "foo");
+ assert_eq!(lower("FooBar").unwrap(), "foobar");
+ assert_eq!(lower("foo").unwrap(), "foo");
}
#[test]
fn test_upper() {
- assert_eq!(upper(&"Foo").unwrap(), "FOO");
- assert_eq!(upper(&"FOO").unwrap(), "FOO");
- assert_eq!(upper(&"FooBar").unwrap(), "FOOBAR");
- assert_eq!(upper(&"foo").unwrap(), "FOO");
+ assert_eq!(upper("Foo").unwrap(), "FOO");
+ assert_eq!(upper("FOO").unwrap(), "FOO");
+ assert_eq!(upper("FooBar").unwrap(), "FOOBAR");
+ assert_eq!(upper("foo").unwrap(), "FOO");
}
#[test]
fn test_trim() {
- assert_eq!(trim(&" Hello\tworld\t").unwrap(), "Hello\tworld");
+ assert_eq!(trim(" Hello\tworld\t").unwrap(), "Hello\tworld");
}
#[test]
fn test_truncate() {
- assert_eq!(truncate(&"hello", 2).unwrap(), "he...");
+ assert_eq!(truncate("hello", 2).unwrap(), "he...");
let a = String::from("您好");
assert_eq!(a.len(), 6);
assert_eq!(String::from("您").len(), 3);
- assert_eq!(truncate(&"您好", 1).unwrap(), "您...");
- assert_eq!(truncate(&"您好", 2).unwrap(), "您...");
- assert_eq!(truncate(&"您好", 3).unwrap(), "您...");
- assert_eq!(truncate(&"您好", 4).unwrap(), "您好...");
- assert_eq!(truncate(&"您好", 6).unwrap(), "您好");
- assert_eq!(truncate(&"您好", 7).unwrap(), "您好");
+ assert_eq!(truncate("您好", 1).unwrap(), "您...");
+ assert_eq!(truncate("您好", 2).unwrap(), "您...");
+ assert_eq!(truncate("您好", 3).unwrap(), "您...");
+ assert_eq!(truncate("您好", 4).unwrap(), "您好...");
+ assert_eq!(truncate("您好", 6).unwrap(), "您好");
+ assert_eq!(truncate("您好", 7).unwrap(), "您好");
let s = String::from("🤚a🤚");
assert_eq!(s.len(), 9);
assert_eq!(String::from("🤚").len(), 4);
- assert_eq!(truncate(&"🤚a🤚", 1).unwrap(), "🤚...");
- assert_eq!(truncate(&"🤚a🤚", 2).unwrap(), "🤚...");
- assert_eq!(truncate(&"🤚a🤚", 3).unwrap(), "🤚...");
- assert_eq!(truncate(&"🤚a🤚", 4).unwrap(), "🤚...");
- assert_eq!(truncate(&"🤚a🤚", 5).unwrap(), "🤚a...");
- assert_eq!(truncate(&"🤚a🤚", 6).unwrap(), "🤚a🤚...");
- assert_eq!(truncate(&"🤚a🤚", 9).unwrap(), "🤚a🤚");
- assert_eq!(truncate(&"🤚a🤚", 10).unwrap(), "🤚a🤚");
+ assert_eq!(truncate("🤚a🤚", 1).unwrap(), "🤚...");
+ assert_eq!(truncate("🤚a🤚", 2).unwrap(), "🤚...");
+ assert_eq!(truncate("🤚a🤚", 3).unwrap(), "🤚...");
+ assert_eq!(truncate("🤚a🤚", 4).unwrap(), "🤚...");
+ assert_eq!(truncate("🤚a🤚", 5).unwrap(), "🤚a...");
+ assert_eq!(truncate("🤚a🤚", 6).unwrap(), "🤚a🤚...");
+ assert_eq!(truncate("🤚a🤚", 9).unwrap(), "🤚a🤚");
+ assert_eq!(truncate("🤚a🤚", 10).unwrap(), "🤚a🤚");
}
#[test]
fn test_indent() {
- assert_eq!(indent(&"hello", 2).unwrap(), "hello");
- assert_eq!(indent(&"hello\n", 2).unwrap(), "hello\n");
- assert_eq!(indent(&"hello\nfoo", 2).unwrap(), "hello\n foo");
+ assert_eq!(indent("hello", 2).unwrap(), "hello");
+ assert_eq!(indent("hello\n", 2).unwrap(), "hello\n");
+ assert_eq!(indent("hello\nfoo", 2).unwrap(), "hello\n foo");
assert_eq!(
- indent(&"hello\nfoo\n bar", 4).unwrap(),
+ indent("hello\nfoo\n bar", 4).unwrap(),
"hello\n foo\n bar"
);
}
@@ -610,15 +610,15 @@ mod tests {
#[test]
fn test_capitalize() {
- assert_eq!(capitalize(&"foo").unwrap(), "Foo".to_string());
- assert_eq!(capitalize(&"f").unwrap(), "F".to_string());
- assert_eq!(capitalize(&"fO").unwrap(), "Fo".to_string());
- assert_eq!(capitalize(&"").unwrap(), "".to_string());
- assert_eq!(capitalize(&"FoO").unwrap(), "Foo".to_string());
- assert_eq!(capitalize(&"foO BAR").unwrap(), "Foo bar".to_string());
- assert_eq!(capitalize(&"äØÄÅÖ").unwrap(), "Äøäåö".to_string());
- assert_eq!(capitalize(&"ß").unwrap(), "SS".to_string());
- assert_eq!(capitalize(&"ßß").unwrap(), "SSß".to_string());
+ assert_eq!(capitalize("foo").unwrap(), "Foo".to_string());
+ assert_eq!(capitalize("f").unwrap(), "F".to_string());
+ assert_eq!(capitalize("fO").unwrap(), "Fo".to_string());
+ assert_eq!(capitalize("").unwrap(), "".to_string());
+ assert_eq!(capitalize("FoO").unwrap(), "Foo".to_string());
+ assert_eq!(capitalize("foO BAR").unwrap(), "Foo bar".to_string());
+ assert_eq!(capitalize("äØÄÅÖ").unwrap(), "Äøäåö".to_string());
+ assert_eq!(capitalize("ß").unwrap(), "SS".to_string());
+ assert_eq!(capitalize("ßß").unwrap(), "SSß".to_string());
}
#[test]
@@ -631,9 +631,9 @@ mod tests {
#[test]
fn test_wordcount() {
- assert_eq!(wordcount(&"").unwrap(), 0);
- assert_eq!(wordcount(&" \n\t").unwrap(), 0);
- assert_eq!(wordcount(&"foo").unwrap(), 1);
- assert_eq!(wordcount(&"foo bar").unwrap(), 2);
+ assert_eq!(wordcount("").unwrap(), 0);
+ assert_eq!(wordcount(" \n\t").unwrap(), 0);
+ assert_eq!(wordcount("foo").unwrap(), 1);
+ assert_eq!(wordcount("foo bar").unwrap(), 2);
}
}
diff --git a/askama/src/filters/yaml.rs b/askama/src/filters/yaml.rs
index ada0ca8..9f4c802 100644
--- a/askama/src/filters/yaml.rs
+++ b/askama/src/filters/yaml.rs
@@ -24,8 +24,8 @@ mod tests {
fn test_yaml() {
assert_eq!(yaml(Html, true).unwrap().to_string(), "true\n");
assert_eq!(yaml(Html, "foo").unwrap().to_string(), "foo\n");
- assert_eq!(yaml(Html, &true).unwrap().to_string(), "true\n");
- assert_eq!(yaml(Html, &"foo").unwrap().to_string(), "foo\n");
+ assert_eq!(yaml(Html, true).unwrap().to_string(), "true\n");
+ assert_eq!(yaml(Html, "foo").unwrap().to_string(), "foo\n");
assert_eq!(
yaml(Html, &vec!["foo", "bar"]).unwrap().to_string(),
"- foo\n- bar\n"
diff --git a/askama/src/lib.rs b/askama/src/lib.rs
index 3af9751..29a64b4 100644
--- a/askama/src/lib.rs
+++ b/askama/src/lib.rs
@@ -163,7 +163,7 @@ impl fmt::Display for dyn DynTemplate {
}
#[cfg(test)]
-#[allow(clippy::blacklisted_name)]
+#[allow(clippy::disallowed_names)]
mod tests {
use std::fmt;
diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs
index 14d4323..2e71ba2 100644
--- a/askama_derive/src/config.rs
+++ b/askama_derive/src/config.rs
@@ -300,7 +300,7 @@ static DEFAULT_ESCAPERS: &[(&[&str], &str)] = &[
];
#[cfg(test)]
-#[allow(clippy::blacklisted_name)]
+#[allow(clippy::disallowed_names)]
mod tests {
use std::env;
use std::path::{Path, PathBuf};
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs
index 7973f45..b171e49 100644
--- a/testing/tests/filters.rs
+++ b/testing/tests/filters.rs
@@ -1,4 +1,4 @@
-#![allow(clippy::blacklisted_name)]
+#![allow(clippy::disallowed_names)]
#[cfg(feature = "serde-json")]
#[macro_use]
diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs
index 35c1204..05fd03b 100644
--- a/testing/tests/matches.rs
+++ b/testing/tests/matches.rs
@@ -1,4 +1,4 @@
-#![allow(clippy::blacklisted_name)]
+#![allow(clippy::disallowed_names)]
use askama::Template;
diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs
index 05c1dab..a63efbe 100644
--- a/testing/tests/operators.rs
+++ b/testing/tests/operators.rs
@@ -1,4 +1,4 @@
-#![allow(clippy::blacklisted_name)]
+#![allow(clippy::disallowed_names)]
use askama::Template;
diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs
index dcd324e..44439c5 100644
--- a/testing/tests/simple.rs
+++ b/testing/tests/simple.rs
@@ -1,4 +1,4 @@
-#![allow(clippy::blacklisted_name)]
+#![allow(clippy::disallowed_names)]
use askama::Template;