diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2023-01-30 09:51:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-30 09:51:23 +0100 |
commit | 3003d86264680433e789d2726d0d12d2c6267c40 (patch) | |
tree | c7e74c13df73d05ec75ee8feec6416733e1de141 | |
parent | 23326b4765b04cb13dd6c72f2103ff9bd6d44d7d (diff) | |
download | askama-3003d86264680433e789d2726d0d12d2c6267c40.tar.gz askama-3003d86264680433e789d2726d0d12d2c6267c40.tar.bz2 askama-3003d86264680433e789d2726d0d12d2c6267c40.zip |
Apply clippy suggestions for 1.67 (#769)
-rw-r--r-- | askama/Cargo.toml | 3 | ||||
-rw-r--r-- | askama/src/error.rs | 6 | ||||
-rw-r--r-- | askama/src/filters/mod.rs | 6 | ||||
-rw-r--r-- | askama/src/lib.rs | 6 | ||||
-rw-r--r-- | askama_actix/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_axum/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_derive/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_derive/src/config.rs | 7 | ||||
-rw-r--r-- | askama_derive/src/generator.rs | 64 | ||||
-rw-r--r-- | askama_derive/src/input.rs | 8 | ||||
-rw-r--r-- | askama_derive/src/parser.rs | 4 | ||||
-rw-r--r-- | askama_escape/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_escape/src/lib.rs | 3 | ||||
-rw-r--r-- | askama_gotham/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_hyper/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_hyper/tests/basic.rs | 2 | ||||
-rw-r--r-- | askama_mendes/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_mendes/tests/basic.rs | 4 | ||||
-rw-r--r-- | askama_rocket/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_tide/Cargo.toml | 3 | ||||
-rw-r--r-- | askama_tide/tests/tide.rs | 1 | ||||
-rw-r--r-- | askama_warp/Cargo.toml | 3 | ||||
-rw-r--r-- | testing/Cargo.toml | 3 | ||||
-rw-r--r-- | testing/tests/filters.rs | 3 | ||||
-rw-r--r-- | testing/tests/simple.rs | 6 |
25 files changed, 82 insertions, 74 deletions
diff --git a/askama/Cargo.toml b/askama/Cargo.toml index a3d841e..7995969 100644 --- a/askama/Cargo.toml +++ b/askama/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "../README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [badges] maintenance = { status = "actively-developed" } diff --git a/askama/src/error.rs b/askama/src/error.rs index 7c959a6..406b148 100644 --- a/askama/src/error.rs +++ b/askama/src/error.rs @@ -56,10 +56,10 @@ impl std::error::Error for Error { impl Display for Error { fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Error::Fmt(err) => write!(formatter, "formatting error: {}", err), - Error::Custom(err) => write!(formatter, "{}", err), + Error::Fmt(err) => write!(formatter, "formatting error: {err}"), + Error::Custom(err) => write!(formatter, "{err}"), #[cfg(feature = "serde_json")] - Error::Json(err) => write!(formatter, "json conversion error: {}", err), + Error::Json(err) => write!(formatter, "json conversion error: {err}"), #[cfg(feature = "serde_yaml")] Error::Yaml(err) => write!(formatter, "yaml conversion error: {}", err), } diff --git a/askama/src/filters/mod.rs b/askama/src/filters/mod.rs index c581967..aed34a1 100644 --- a/askama/src/filters/mod.rs +++ b/askama/src/filters/mod.rs @@ -163,7 +163,7 @@ pub fn linebreaks<T: fmt::Display>(s: T) -> Result<String> { let s = s.to_string(); let linebroken = s.replace("\n\n", "</p><p>").replace('\n', "<br/>"); - Ok(format!("<p>{}</p>", linebroken)) + Ok(format!("<p>{linebroken}</p>")) } /// Converts all newlines in a piece of plain text to HTML line breaks @@ -181,7 +181,7 @@ pub fn paragraphbreaks<T: fmt::Display>(s: T) -> Result<String> { let s = s.to_string(); let linebroken = s.replace("\n\n", "</p><p>").replace("<p></p>", ""); - Ok(format!("<p>{}</p>", linebroken)) + Ok(format!("<p>{linebroken}</p>")) } /// Converts to lowercase @@ -279,7 +279,7 @@ where rv.push_str(separator); } - write!(rv, "{}", item)?; + write!(rv, "{item}")?; } Ok(rv) diff --git a/askama/src/lib.rs b/askama/src/lib.rs index 91cf62e..17085b5 100644 --- a/askama/src/lib.rs +++ b/askama/src/lib.rs @@ -93,7 +93,7 @@ pub trait Template: fmt::Display { /// Renders the template to the given `writer` io buffer #[inline] fn write_into(&self, writer: &mut (impl std::io::Write + ?Sized)) -> std::io::Result<()> { - writer.write_fmt(format_args!("{}", self)) + writer.write_fmt(format_args!("{self}")) } /// The template's extension, if provided @@ -140,7 +140,7 @@ impl<T: Template> DynTemplate for T { #[inline] fn dyn_write_into(&self, writer: &mut dyn std::io::Write) -> std::io::Result<()> { - writer.write_fmt(format_args!("{}", self)) + writer.write_fmt(format_args!("{self}")) } fn extension(&self) -> Option<&'static str> { @@ -201,7 +201,7 @@ mod tests { assert_eq!(test.to_string(), "test"); - assert_eq!(format!("{}", test), "test"); + assert_eq!(format!("{test}"), "test"); let mut vec = Vec::new(); test.dyn_write_into(&mut vec).unwrap(); diff --git a/askama_actix/Cargo.toml b/askama_actix/Cargo.toml index 838ca6d..a6c124a 100644 --- a/askama_actix/Cargo.toml +++ b/askama_actix/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [dependencies] actix-web = { version = "4", default-features = false } diff --git a/askama_axum/Cargo.toml b/askama_axum/Cargo.toml index 7e63851..ee410a7 100644 --- a/askama_axum/Cargo.toml +++ b/askama_axum/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "askama_axum" version = "0.1.0" -edition = "2018" +edition = "2021" +rust-version = "1.58" description = "Axum integration for Askama templates" keywords = ["markup", "template", "jinja2", "html", "axum"] categories = ["template-engine"] diff --git a/askama_derive/Cargo.toml b/askama_derive/Cargo.toml index 1d176b7..61cce97 100644 --- a/askama_derive/Cargo.toml +++ b/askama_derive/Cargo.toml @@ -7,7 +7,8 @@ repository = "https://github.com/djc/askama" license = "MIT/Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [lib] proc-macro = true diff --git a/askama_derive/src/config.rs b/askama_derive/src/config.rs index cb0126c..8c49217 100644 --- a/askama_derive/src/config.rs +++ b/askama_derive/src/config.rs @@ -1,5 +1,4 @@ use std::collections::{BTreeMap, HashSet}; -use std::convert::TryFrom; use std::path::{Path, PathBuf}; use std::{env, fs}; @@ -58,13 +57,13 @@ impl Config<'_> { .insert(name.to_string(), Syntax::try_from(raw_s)?) .is_some() { - return Err(format!("syntax \"{}\" is already defined", name).into()); + return Err(format!("syntax \"{name}\" is already defined").into()); } } } if !syntaxes.contains_key(default_syntax) { - return Err(format!("default syntax \"{}\" not found", default_syntax).into()); + return Err(format!("default syntax \"{default_syntax}\" not found").into()); } let mut escapers = Vec::new(); @@ -193,7 +192,7 @@ struct RawConfig<'d> { impl RawConfig<'_> { #[cfg(feature = "config")] fn from_toml_str(s: &str) -> std::result::Result<RawConfig<'_>, CompileError> { - toml::from_str(s).map_err(|e| format!("invalid TOML in {}: {}", CONFIG_FILE_NAME, e).into()) + toml::from_str(s).map_err(|e| format!("invalid TOML in {CONFIG_FILE_NAME}: {e}").into()) } #[cfg(not(feature = "config"))] diff --git a/askama_derive/src/generator.rs b/askama_derive/src/generator.rs index 08c1de1..5770bd5 100644 --- a/askama_derive/src/generator.rs +++ b/askama_derive/src/generator.rs @@ -70,7 +70,7 @@ fn build_template(ast: &syn::DeriveInput) -> Result<String, CompileError> { ) .build(&contexts[input.path.as_path()])?; if input.print == Print::Code || input.print == Print::All { - eprintln!("{}", code); + eprintln!("{code}"); } Ok(code) } @@ -106,7 +106,7 @@ impl TemplateArgs { template_args = Some(nested); } Ok(_) => return Err("'template' attribute must be a list".into()), - Err(e) => return Err(format!("unable to parse attribute: {}", e).into()), + Err(e) => return Err(format!("unable to parse attribute: {e}").into()), } } } @@ -182,7 +182,7 @@ impl TemplateArgs { return Err("config value must be string literal".into()); } } else { - return Err(format!("unsupported attribute key {:?} found", ident).into()); + return Err(format!("unsupported attribute key {ident:?} found").into()); } } @@ -362,7 +362,7 @@ impl<'a> Generator<'a> { buf.writeln(";")?; buf.writeln("const SIZE_HINT: ::std::primitive::usize = ")?; - buf.writeln(&format!("{}", size_hint))?; + buf.writeln(&format!("{size_hint}"))?; buf.writeln(";")?; buf.writeln("const MIME_TYPE: &'static ::std::primitive::str = ")?; @@ -478,7 +478,7 @@ impl<'a> Generator<'a> { buf.writeln( format!( "{} {} for {} {} {{", - quote!(impl#impl_generics), + quote!(impl #impl_generics), "::mendes::application::IntoResponse<A>", self.input.ast.ident, quote!(#orig_ty_generics #where_clause), @@ -573,7 +573,7 @@ impl<'a> Generator<'a> { buf.writeln( format!( "{} {} for {}{} {{", - quote!(impl#impl_generics), + quote!(impl #impl_generics), target, self.input.ast.ident, quote!(#orig_ty_generics #where_clause), @@ -755,7 +755,7 @@ impl<'a> Generator<'a> { let mut arm_sizes = Vec::new(); let expr_code = self.visit_expr_root(expr)?; - buf.writeln(&format!("match &{} {{", expr_code))?; + buf.writeln(&format!("match &{expr_code} {{"))?; let mut arm_size = 0; for (i, arm) in arms.iter().enumerate() { @@ -802,24 +802,24 @@ impl<'a> Generator<'a> { buf.writeln("{")?; buf.writeln("let mut _did_loop = false;")?; match loop_block.iter { - Expr::Range(_, _, _) => buf.writeln(&format!("let _iter = {};", expr_code)), - Expr::Array(..) => buf.writeln(&format!("let _iter = {}.iter();", expr_code)), + Expr::Range(_, _, _) => buf.writeln(&format!("let _iter = {expr_code};")), + Expr::Array(..) => buf.writeln(&format!("let _iter = {expr_code}.iter();")), // If `iter` is a call then we assume it's something that returns // an iterator. If not then the user can explicitly add the needed // call without issues. Expr::Call(..) | Expr::Index(..) => { - buf.writeln(&format!("let _iter = ({}).into_iter();", expr_code)) + buf.writeln(&format!("let _iter = ({expr_code}).into_iter();")) } // If accessing `self` then it most likely needs to be // borrowed, to prevent an attempt of moving. _ if expr_code.starts_with("self.") => { - buf.writeln(&format!("let _iter = (&{}).into_iter();", expr_code)) + buf.writeln(&format!("let _iter = (&{expr_code}).into_iter();")) } // If accessing a field then it most likely needs to be // borrowed, to prevent an attempt of moving. - Expr::Attr(..) => buf.writeln(&format!("let _iter = (&{}).into_iter();", expr_code)), + Expr::Attr(..) => buf.writeln(&format!("let _iter = (&{expr_code}).into_iter();")), // Otherwise, we borrow `iter` assuming that it implements `IntoIterator`. - _ => buf.writeln(&format!("let _iter = ({}).into_iter();", expr_code)), + _ => buf.writeln(&format!("let _iter = ({expr_code}).into_iter();")), }?; if let Some(cond) = &loop_block.cond { self.locals.push(); @@ -872,13 +872,14 @@ impl<'a> Generator<'a> { let (def, own_ctx) = match scope { Some(s) => { let path = ctx.imports.get(s).ok_or_else(|| { - CompileError::from(format!("no import found for scope {:?}", s)) - })?; - let mctx = self.contexts.get(path.as_path()).ok_or_else(|| { - CompileError::from(format!("context for {:?} not found", path)) + CompileError::from(format!("no import found for scope {s:?}")) })?; + let mctx = self + .contexts + .get(path.as_path()) + .ok_or_else(|| CompileError::from(format!("context for {path:?} not found")))?; let def = mctx.macros.get(name).ok_or_else(|| { - CompileError::from(format!("macro {:?} not found in scope {:?}", name, s)) + CompileError::from(format!("macro {name:?} not found in scope {s:?}")) })?; (def, mctx) } @@ -886,7 +887,7 @@ impl<'a> Generator<'a> { let def = ctx .macros .get(name) - .ok_or_else(|| CompileError::from(format!("macro {:?} not found", name)))?; + .ok_or_else(|| CompileError::from(format!("macro {name:?} not found")))?; (def, ctx) } }; @@ -902,7 +903,7 @@ impl<'a> Generator<'a> { let mut is_first_variable = true; for (i, arg) in def.args.iter().enumerate() { let expr = args.get(i).ok_or_else(|| { - CompileError::from(format!("macro {:?} takes more than {} arguments", name, i)) + CompileError::from(format!("macro {name:?} takes more than {i} arguments")) })?; match expr { @@ -1089,7 +1090,7 @@ impl<'a> Generator<'a> { (Some(cur_name), None) => (cur_name, 0), // A block definition contains a block definition of the same name (Some(cur_name), Some((prev_name, _))) if cur_name == prev_name => { - return Err(format!("cannot define recursive blocks ({})", cur_name).into()); + return Err(format!("cannot define recursive blocks ({cur_name})").into()); } // A block definition contains a definition of another block (Some(cur_name), Some((_, _))) => (cur_name, 0), @@ -1108,7 +1109,7 @@ impl<'a> Generator<'a> { let (ctx, def) = heritage.blocks[cur.0].get(cur.1).ok_or_else(|| { CompileError::from(match name { None => format!("no super() block found for block '{}'", cur.0), - Some(name) => format!("no block found for name '{}'", name), + Some(name) => format!("no block found for name '{name}'"), }) })?; @@ -1193,7 +1194,7 @@ impl<'a> Generator<'a> { let id = self.named; self.named += 1; - buf_expr.write(&format!("expr{} = ", id)); + buf_expr.write(&format!("expr{id} = ")); buf_expr.write("&"); buf_expr.write(&expression); buf_expr.writeln(",")?; @@ -1206,7 +1207,7 @@ impl<'a> Generator<'a> { } }; - buf_format.write(&format!("{{expr{}}}", id)); + buf_format.write(&format!("{{expr{id}}}")); size_hint += 3; } } @@ -1395,9 +1396,9 @@ impl<'a> Generator<'a> { name, self.input.escaper )); } else if crate::BUILT_IN_FILTERS.contains(&name) { - buf.write(&format!("::askama::filters::{}(", name)); + buf.write(&format!("::askama::filters::{name}(")); } else { - buf.write(&format!("filters::{}(", name)); + buf.write(&format!("filters::{name}(")); } self._visit_args(buf, args)?; @@ -1601,7 +1602,7 @@ impl<'a> Generator<'a> { } _ => return Err("loop.cycle(…) expects exactly one argument".into()), }, - s => return Err(format!("unknown loop method: {:?}", s).into()), + s => return Err(format!("unknown loop method: {s:?}").into()), }, left => { match left { @@ -1658,7 +1659,7 @@ impl<'a> Generator<'a> { right: &Expr<'_>, ) -> Result<DisplayWrap, CompileError> { self.visit_expr(buf, left)?; - buf.write(&format!(" {} ", op)); + buf.write(&format!(" {op} ")); self.visit_expr(buf, right)?; Ok(DisplayWrap::Unwrapped) } @@ -1733,12 +1734,12 @@ impl<'a> Generator<'a> { } fn visit_str_lit(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap { - buf.write(&format!("\"{}\"", s)); + buf.write(&format!("\"{s}\"")); DisplayWrap::Unwrapped } fn visit_char_lit(&mut self, buf: &mut Buffer, s: &str) -> DisplayWrap { - buf.write(&format!("'{}'", s)); + buf.write(&format!("'{s}'")); DisplayWrap::Unwrapped } @@ -2032,8 +2033,7 @@ impl MapChain<'_, &str, LocalMeta> { fn resolve_or_self(&self, name: &str) -> String { let name = normalize_identifier(name); - self.resolve(name) - .unwrap_or_else(|| format!("self.{}", name)) + self.resolve(name).unwrap_or_else(|| format!("self.{name}")) } } diff --git a/askama_derive/src/input.rs b/askama_derive/src/input.rs index 68d01db..47d51bd 100644 --- a/askama_derive/src/input.rs +++ b/askama_derive/src/input.rs @@ -42,7 +42,7 @@ impl TemplateInput<'_> { // of `ext` is merged into a synthetic `path` value here. let source = source.expect("template path or source not found in attributes"); let path = match (&source, &ext) { - (&Source::Path(ref path), _) => config.find_template(path, None)?, + (Source::Path(path), _) => config.find_template(path, None)?, (&Source::Source(_), Some(ext)) => PathBuf::from(format!("{}.{}", ast.ident, ext)), (&Source::Source(_), None) => { return Err("must include 'ext' attribute when using 'source' attribute".into()) @@ -56,7 +56,7 @@ impl TemplateInput<'_> { config .syntaxes .get(&s) - .ok_or_else(|| CompileError::from(format!("attribute syntax {} not exist", s))) + .ok_or_else(|| CompileError::from(format!("attribute syntax {s} not exist"))) }, )?; @@ -78,7 +78,7 @@ impl TemplateInput<'_> { } let escaper = escaper.ok_or_else(|| { - CompileError::from(format!("no escaper defined for extension '{}'", escaping)) + CompileError::from(format!("no escaper defined for extension '{escaping}'")) })?; let mime_type = @@ -146,7 +146,7 @@ impl FromStr for Print { "ast" => Ast, "code" => Code, "none" => None, - v => return Err(format!("invalid value for print option: {}", v,).into()), + v => return Err(format!("invalid value for print option: {v}",).into()), }) } } diff --git a/askama_derive/src/parser.rs b/askama_derive/src/parser.rs index 650eabf..c59177a 100644 --- a/askama_derive/src/parser.rs +++ b/askama_derive/src/parser.rs @@ -1238,7 +1238,7 @@ pub(crate) fn parse<'a>( match parse_template(src, &state) { Ok((left, res)) => { if !left.is_empty() { - Err(format!("unable to parse template:\n\n{:?}", left).into()) + Err(format!("unable to parse template:\n\n{left:?}").into()) } else { Ok(res) } @@ -1251,7 +1251,7 @@ pub(crate) fn parse<'a>( let source_after = match source_after.char_indices().enumerate().take(41).last() { Some((40, (i, _))) => format!("{:?}...", &source_after[..i]), - _ => format!("{:?}", source_after), + _ => format!("{source_after:?}"), }; let (row, last_line) = source_before.lines().enumerate().last().unwrap(); diff --git a/askama_escape/Cargo.toml b/askama_escape/Cargo.toml index 9af4b72..1521a69 100644 --- a/askama_escape/Cargo.toml +++ b/askama_escape/Cargo.toml @@ -9,7 +9,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [badges] maintenance = { status = "actively-developed" } diff --git a/askama_escape/src/lib.rs b/askama_escape/src/lib.rs index 8e57906..c388f2d 100644 --- a/askama_escape/src/lib.rs +++ b/askama_escape/src/lib.rs @@ -56,8 +56,7 @@ where fmt, escaper: &self.escaper }, - "{}", - t + "{t}" ), DisplayValue::Safe(ref t) => t.fmt(fmt), } diff --git a/askama_gotham/Cargo.toml b/askama_gotham/Cargo.toml index bb08816..717d57e 100644 --- a/askama_gotham/Cargo.toml +++ b/askama_gotham/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [dependencies] askama = { version = "0.11.2", path = "../askama", default-features = false, features = ["with-gotham", "mime", "mime_guess"] } diff --git a/askama_hyper/Cargo.toml b/askama_hyper/Cargo.toml index 6a7a213..dfdfbd0 100644 --- a/askama_hyper/Cargo.toml +++ b/askama_hyper/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [dependencies] askama = { version = "0.11.2", path = "../askama", default-features = false, features = ["with-hyper"] } diff --git a/askama_hyper/tests/basic.rs b/askama_hyper/tests/basic.rs index d0038c1..efa8ba5 100644 --- a/askama_hyper/tests/basic.rs +++ b/askama_hyper/tests/basic.rs @@ -43,7 +43,7 @@ async fn test_hyper() { server.await.expect("Could not serve"); }; let query = async move { - let uri = format!("http://{}/hello/world", local_addr) + let uri = format!("http://{local_addr}/hello/world") .parse() .expect("Could not format URI"); let client = Client::new(); diff --git a/askama_mendes/Cargo.toml b/askama_mendes/Cargo.toml index 661acdd..06fed2f 100644 --- a/askama_mendes/Cargo.toml +++ b/askama_mendes/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [dependencies] askama = { version = "0.11.2", path = "../askama", default-features = false, features = ["with-mendes", "mime", "mime_guess"] } diff --git a/askama_mendes/tests/basic.rs b/askama_mendes/tests/basic.rs index c9ef810..6ab1d6d 100644 --- a/askama_mendes/tests/basic.rs +++ b/askama_mendes/tests/basic.rs @@ -71,8 +71,8 @@ impl From<mendes::Error> for Error { impl std::fmt::Display for Error { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { - Error::Askama(e) => write!(f, "{}", e), - Error::Mendes(e) => write!(f, "{}", e), + Error::Askama(e) => write!(f, "{e}"), + Error::Mendes(e) => write!(f, "{e}"), } } } diff --git a/askama_rocket/Cargo.toml b/askama_rocket/Cargo.toml index 53a0953..4abb112 100644 --- a/askama_rocket/Cargo.toml +++ b/askama_rocket/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [dependencies] askama = { version = "0.11.2", path = "../askama", default-features = false, features = ["with-rocket", "mime", "mime_guess"] } diff --git a/askama_tide/Cargo.toml b/askama_tide/Cargo.toml index 328a661..056c919 100644 --- a/askama_tide/Cargo.toml +++ b/askama_tide/Cargo.toml @@ -1,7 +1,8 @@ [package] name = "askama_tide" version = "0.14.0" -edition = "2018" +edition = "2021" +rust-version = "1.58" description = "Tide integration for Askama templates" keywords = ["markup", "template", "html", "tide", "http-types"] homepage = "https://github.com/djc/askama" diff --git a/askama_tide/tests/tide.rs b/askama_tide/tests/tide.rs index 6fa1418..44a065e 100644 --- a/askama_tide/tests/tide.rs +++ b/askama_tide/tests/tide.rs @@ -1,6 +1,5 @@ use askama::Template; use async_std::prelude::*; -use std::convert::TryInto; use tide::{http::mime::HTML, Body, Response}; #[derive(Template)] diff --git a/askama_warp/Cargo.toml b/askama_warp/Cargo.toml index b1a2d51..f2f05d6 100644 --- a/askama_warp/Cargo.toml +++ b/askama_warp/Cargo.toml @@ -10,7 +10,8 @@ repository = "https://github.com/djc/askama" license = "MIT OR Apache-2.0" workspace = ".." readme = "README.md" -edition = "2018" +edition = "2021" +rust-version = "1.58" [dependencies] askama = { version = "0.11.2", path = "../askama", default-features = false, features = ["with-warp", "mime", "mime_guess"] } diff --git a/testing/Cargo.toml b/testing/Cargo.toml index cd7d686..e1f1bb4 100644 --- a/testing/Cargo.toml +++ b/testing/Cargo.toml @@ -3,7 +3,8 @@ name = "askama_testing" version = "0.1.0" authors = ["Dirkjan Ochtman <dirkjan@ochtman.nl>"] workspace = ".." -edition = "2018" +edition = "2021" +rust-version = "1.58" publish = false [features] diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs index 5229ecd..b397e28 100644 --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -122,8 +122,7 @@ mod filters { } // for test_nested_filter_ref pub fn mytrim(s: &dyn (::std::fmt::Display)) -> ::askama::Result<String> { - let s = format!("{}", s); - Ok(s.trim().to_owned()) + Ok(s.to_string().trim().to_owned()) } } diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index ebc8267..627a8a3 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -311,14 +311,14 @@ struct FunctionRefTemplate { #[test] fn test_func_ref_call() { let t = FunctionRefTemplate { - world: |s, r| format!("world({}, {})", s, r), + world: |s, r| format!("world({s}, {r})"), }; assert_eq!(t.render().unwrap(), "Hello, world(123, 4)!"); } #[allow(clippy::trivially_copy_pass_by_ref)] fn world2(s: &str, v: u8) -> String { - format!("world{}{}", v, s) + format!("world{v}{s}") } #[derive(Template)] @@ -346,7 +346,7 @@ struct FunctionTemplate; impl FunctionTemplate { #[allow(clippy::trivially_copy_pass_by_ref)] fn world3(&self, s: &str, v: u8) -> String { - format!("world{}{}", s, v) + format!("world{s}{v}") } } |