Add a lint to warn about call to .*or(foo(..))
This commit is contained in:
parent
604be945d2
commit
c6604bb281
5 changed files with 90 additions and 4 deletions
|
|
@ -244,7 +244,7 @@ pub fn is_from_for_desugar(decl: &Decl) -> bool {
|
|||
/// snippet(cx, expr.span, "..")
|
||||
/// ```
|
||||
pub fn snippet<'a, T: LintContext>(cx: &T, span: Span, default: &'a str) -> Cow<'a, str> {
|
||||
cx.sess().codemap().span_to_snippet(span).map(From::from).unwrap_or(Cow::Borrowed(default))
|
||||
cx.sess().codemap().span_to_snippet(span).map(From::from).unwrap_or_else(|_| Cow::Borrowed(default))
|
||||
}
|
||||
|
||||
/// Convert a span to a code snippet. Returns `None` if not available.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue