diff options
| author | bors <bors@rust-lang.org> | 2024-06-21 16:07:03 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-06-21 16:07:03 +0000 |
| commit | fe2fe7feed08fe0296e74a6352d367a40703cc30 (patch) | |
| tree | 384b5f0246a7182f03797ad95a9c0915f7af5538 /clippy_lints/src/multiple_bound_locations.rs | |
| parent | 3e84ca8ac95623bc5a36886873b12bd95fd8f700 (diff) | |
| parent | 4baae5d8b3f5b681097c5afe9ad3e1494f223b1b (diff) | |
Auto merge of #12972 - Jarcho:span_ex, r=Manishearth
Add new span related utils The none-generic versions of the functions exist to help with both compile times and codegen. changelog: None
Diffstat (limited to 'clippy_lints/src/multiple_bound_locations.rs')
| -rw-r--r-- | clippy_lints/src/multiple_bound_locations.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/clippy_lints/src/multiple_bound_locations.rs b/clippy_lints/src/multiple_bound_locations.rs index d608f3bf7b4..d276e29bace 100644 --- a/clippy_lints/src/multiple_bound_locations.rs +++ b/clippy_lints/src/multiple_bound_locations.rs @@ -6,7 +6,7 @@ use rustc_session::declare_lint_pass; use rustc_span::Span; use clippy_utils::diagnostics::span_lint; -use clippy_utils::source::snippet_opt; +use clippy_utils::source::SpanRangeExt; declare_clippy_lint! { /// ### What it does @@ -54,8 +54,10 @@ impl EarlyLintPass for MultipleBoundLocations { match clause { WherePredicate::BoundPredicate(pred) => { if (!pred.bound_generic_params.is_empty() || !pred.bounds.is_empty()) - && let Some(name) = snippet_opt(cx, pred.bounded_ty.span) - && let Some(bound_span) = generic_params_with_bounds.get(name.as_str()) + && let Some(Some(bound_span)) = pred + .bounded_ty + .span + .with_source_text(cx, |src| generic_params_with_bounds.get(src)) { emit_lint(cx, *bound_span, pred.bounded_ty.span); } |
