- .outer()
- .expn_info()
- .map_or(expr.span, |info| info.call_site);
- span_lint_and_then(
- cx,
- RANGE_PLUS_ONE,
- span,
- "an inclusive range would be more readable",
- |db| {
- let start = start.map_or(String::new(), |x| Sugg::hir(cx, x, "x").to_string());
- let end = Sugg::hir(cx, y, "y");
- if let Some(is_wrapped) = &snippet_opt(cx, span) {
- if is_wrapped.starts_with('(') && is_wrapped.ends_with(')') {
- db.span_suggestion(
- span,
- "use",
- format!("({}..={})", start, end),
- Applicability::MaybeIncorrect,
- );
- } else {
- db.span_suggestion(
- span,
- "use",
- format!("{}..={}", start, end),
- Applicability::MachineApplicable, // snippet
- );
- }
+ .outer_expn_data()
+ .call_site
+ } else {
+ expr.span
+ };
+ span_lint_and_then(
+ cx,
+ RANGE_PLUS_ONE,
+ span,
+ "an inclusive range would be more readable",
+ |db| {
+ let start = start.map_or(String::new(), |x| Sugg::hir(cx, x, "x").to_string());
+ let end = Sugg::hir(cx, y, "y");
+ if let Some(is_wrapped) = &snippet_opt(cx, span) {
+ if is_wrapped.starts_with('(') && is_wrapped.ends_with(')') {
+ db.span_suggestion(
+ span,
+ "use",
+ format!("({}..={})", start, end),
+ Applicability::MaybeIncorrect,
+ );
+ } else {
+ db.span_suggestion(
+ span,
+ "use",
+ format!("{}..={}", start, end),
+ Applicability::MachineApplicable, // snippet
+ );