Lint against patterns like <Result<_,_> as anyhow::Context>::context(r, &format!("...", ...))
in favor of .with_context(|| ...)
#13678
Labels
A-lint
Area: New lints
What it does
Warn users that they will be unconditionally calling a function (or causing a heap allocation) even when the result which is the receiver is
Ok(...)
.This would be analogous to
expect_fun_call
oror_fun_call
but foranyhow::Context
.Advantage
Drawbacks
Example
Could be written as:
The text was updated successfully, but these errors were encountered: