-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typo fix and smaller refactorings #650
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
warning: this `map_or` can be simplified --> minijinja-py/src/typeconv.rs:258:8 | 258 | if callback | ________^ 259 | | .getattr("__minijinja_pass_state__") 260 | | .map_or(false, |x| x.is_truthy().unwrap_or(false)) | |__________________________________________________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `#[warn(clippy::unnecessary_map_or)]` on by default help: use is_ok_and instead | 258 ~ if callback 259 + .getattr("__minijinja_pass_state__").is_ok_and(|x| x.is_truthy().unwrap_or(false)) | warning: this `map_or` can be simplified --> minijinja/src/value/mod.rs:542:41 | 542 | ... b.get_value(&k).map_or(false, |v2| v1 == v2) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use a standard comparison instead: `(b.get_value(&k) == Some(v1))` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or = note: `#[warn(clippy::unnecessary_map_or)]` on by default
warning: this `match` expression can be replaced with `?` --> minijinja/src/compiler/lexer.rs:90:19 | 90 | let idx = match memchr(&bytes[offset..], b'{') { | ___________________^ 91 | | Some(idx) => idx, 92 | | None => return None, 93 | | }; | |_________^ help: try instead: `memchr(&bytes[offset..], b'{')?` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark = note: `#[warn(clippy::question_mark)]` on by default warning: this `match` expression can be replaced with `?` --> minijinja/src/compiler/lexer.rs:533:31 | 533 | Token::String(match unescape(&s[1..s.len() - 1]) { | _______________________________^ 534 | | Ok(unescaped) => unescaped, 535 | | Err(err) => return Err(err), 536 | | }), | |_________________^ help: try instead: `unescape(&s[1..s.len() - 1])?` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#question_mark
warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/ast.rs:91:6 | 91 | impl<'a> fmt::Debug for Stmt<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 91 - impl<'a> fmt::Debug for Stmt<'a> { 91 + impl fmt::Debug for Stmt<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/ast.rs:151:6 | 151 | impl<'a> fmt::Debug for Expr<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 151 - impl<'a> fmt::Debug for Expr<'a> { 151 + impl fmt::Debug for Expr<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/ast.rs:171:6 | 171 | impl<'a> Expr<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 171 - impl<'a> Expr<'a> { 171 + impl Expr<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/ast.rs:497:6 | 497 | impl<'a> List<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 497 - impl<'a> List<'a> { 497 + impl List<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/ast.rs:521:6 | 521 | impl<'a> Map<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 521 - impl<'a> Map<'a> { 521 + impl Map<'_> { | warning: the following explicit lifetimes could be elided: 'source --> minijinja/src/compiler/instructions.rs:441:6 | 441 | impl<'source> fmt::Debug for Instructions<'source> { | ^^^^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 441 - impl<'source> fmt::Debug for Instructions<'source> { 441 + impl fmt::Debug for Instructions<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/instructions.rs:445:14 | 445 | impl<'a> fmt::Debug for InstructionWrapper<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 445 - impl<'a> fmt::Debug for InstructionWrapper<'a> { 445 + impl fmt::Debug for InstructionWrapper<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/tokens.rs:85:6 | 85 | impl<'a> fmt::Display for Token<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 85 - impl<'a> fmt::Display for Token<'a> { 85 + impl fmt::Display for Token<'_> { | warning: the following explicit lifetimes could be elided: 'source --> minijinja/src/environment.rs:64:6 | 64 | impl<'source> Default for Environment<'source> { | ^^^^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 64 - impl<'source> Default for Environment<'source> { 64 + impl Default for Environment<'_> { | warning: the following explicit lifetimes could be elided: 'source --> minijinja/src/environment.rs:70:6 | 70 | impl<'source> fmt::Debug for Environment<'source> { | ^^^^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 70 - impl<'source> fmt::Debug for Environment<'source> { 70 + impl fmt::Debug for Environment<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/error.rs:321:14 | 321 | impl<'a> fmt::Display for Proxy<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 321 - impl<'a> fmt::Display for Proxy<'a> { 321 + impl fmt::Display for Proxy<'_> { | warning: the following explicit lifetimes could be elided: 'env, 'source --> minijinja/src/expression.rs:47:6 | 47 | impl<'env, 'source> fmt::Debug for Expression<'env, 'source> { | ^^^^ ^^^^^^^ ^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 47 - impl<'env, 'source> fmt::Debug for Expression<'env, 'source> { 47 + impl fmt::Debug for Expression<'_, '_> { | warning: the following explicit lifetimes could be elided: 'env, 'source --> minijinja/src/template.rs:58:6 | 58 | impl<'env, 'source> fmt::Debug for Template<'env, 'source> { | ^^^^ ^^^^^^^ ^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 58 - impl<'env, 'source> fmt::Debug for Template<'env, 'source> { 58 + impl fmt::Debug for Template<'_, '_> { | warning: the following explicit lifetimes could be elided: 'env --> minijinja/src/template.rs:323:6 | 323 | impl<'env, 'source> Deref for CompiledTemplateRef<'env, 'source> { | ^^^^ ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 323 - impl<'env, 'source> Deref for CompiledTemplateRef<'env, 'source> { 323 + impl<'source> Deref for CompiledTemplateRef<'_, 'source> { | warning: the following explicit lifetimes could be elided: 'env --> minijinja/src/template.rs:348:6 | 348 | impl<'env> fmt::Debug for CompiledTemplate<'env> { | ^^^^ ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 348 - impl<'env> fmt::Debug for CompiledTemplate<'env> { 348 + impl fmt::Debug for CompiledTemplate<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/utils.rs:190:6 | 190 | impl<'a> fmt::Display for HtmlEscape<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 190 - impl<'a> fmt::Display for HtmlEscape<'a> { 190 + impl fmt::Display for HtmlEscape<'_> { | warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/utils.rs:322:6 | 322 | impl<'a, K: fmt::Debug, V> fmt::Debug for BTreeMapKeysDebug<'a, K, V> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 322 - impl<'a, K: fmt::Debug, V> fmt::Debug for BTreeMapKeysDebug<'a, K, V> { 322 + impl<K: fmt::Debug, V> fmt::Debug for BTreeMapKeysDebug<'_, K, V> { | warning: the following explicit lifetimes could be elided: 'env --> minijinja/src/vm/context.rs:66:6 | 66 | impl<'env> fmt::Debug for Frame<'env> { | ^^^^ ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 66 - impl<'env> fmt::Debug for Frame<'env> { 66 + impl fmt::Debug for Frame<'_> { | warning: the following explicit lifetimes could be elided: 'env --> minijinja/src/vm/context.rs:146:6 | 146 | impl<'env> fmt::Debug for Context<'env> { | ^^^^ ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 146 - impl<'env> fmt::Debug for Context<'env> { 146 + impl fmt::Debug for Context<'_> { | warning: the following explicit lifetimes could be elided: 'template, 'env --> minijinja/src/vm/state.rs:60:6 | 60 | impl<'template, 'env> fmt::Debug for State<'template, 'env> { | ^^^^^^^^^ ^^^^ ^^^^^^^^^ ^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 60 - impl<'template, 'env> fmt::Debug for State<'template, 'env> { 60 + impl fmt::Debug for State<'_, '_> { | warning: the following explicit lifetimes could be elided: 'de --> minijinja/src/value/deserialize.rs:161:6 | 161 | impl<'de> IntoDeserializer<'de, Error> for Value { | ^^^ ^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 161 - impl<'de> IntoDeserializer<'de, Error> for Value { 161 + impl IntoDeserializer<'_, Error> for Value { | warning: the following explicit lifetimes could be elided: 'v --> minijinja/src/value/deserialize.rs:346:11 | 346 | impl<'de, 'v> Deserializer<'de> for &'v Value { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 346 - impl<'de, 'v> Deserializer<'de> for &'v Value { 346 + impl<'de> Deserializer<'de> for &Value { | warning: the following explicit lifetimes could be elided: 'source --> minijinja/src/loader.rs:34:6 | 34 | impl<'source> fmt::Debug for LoaderStore<'source> { | ^^^^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 34 - impl<'source> fmt::Debug for LoaderStore<'source> { 34 + impl fmt::Debug for LoaderStore<'_> { | warning: the following explicit lifetimes could be elided: 'x --> minijinja/src/debug.rs:18:6 | 18 | impl<'x> fmt::Debug for VarPrinter<'x> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 18 - impl<'x> fmt::Debug for VarPrinter<'x> { 18 + impl fmt::Debug for VarPrinter<'_> { | warning: `minijinja` (lib) generated 24 warnings (run `cargo clippy --fix --lib -p minijinja` to apply 24 suggestions) warning: the following explicit lifetimes could be elided: 'a --> minijinja/src/compiler/ast.rs:171:6 | 171 | impl<'a> Expr<'a> { | ^^ ^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 171 - impl<'a> Expr<'a> { 171 + impl Expr<'_> { | warning: the following explicit lifetimes could be elided: 'source --> minijinja/src/environment.rs:823:10 | 823 | impl<'source> fmt::Debug for BasicStore<'source> { | ^^^^^^^ ^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes help: elide the lifetimes | 823 - impl<'source> fmt::Debug for BasicStore<'source> { 823 + impl fmt::Debug for BasicStore<'_> { | warning: `minijinja` (lib) generated 15 warnings (13 duplicates) (run `cargo clippy --fix --lib -p minijinja` to apply 2 suggestions) warning: the following explicit lifetimes could be elided: 'reloader --> minijinja-autoreload/src/lib.rs:112:6 | 112 | impl<'reloader> Deref for EnvironmentGuard<'reloader> { | ^^^^^^^^^ ^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `#[warn(clippy::needless_lifetimes)]` on by default help: elide the lifetimes | 112 - impl<'reloader> Deref for EnvironmentGuard<'reloader> { 112 + impl Deref for EnvironmentGuard<'_> { |
error: the following explicit lifetimes could be elided: 'reloader --> minijinja-autoreload/src/lib.rs:112:6 | 112 | impl<'reloader> Deref for EnvironmentGuard<'reloader> { | ^^^^^^^^^ ^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes = note: `-D clippy::needless-lifetimes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_lifetimes)]` help: elide the lifetimes | 112 - impl<'reloader> Deref for EnvironmentGuard<'reloader> { 112 + impl Deref for EnvironmentGuard<'_> { | error: could not compile `minijinja-autoreload` (lib) due to 1 previous error warning: build failed, waiting for other jobs to finish...
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Interestingly, "disciminant" was missed by typos...
Also applied clippy::question_mark and clippy::unnecessary_map_or.