avoid full-slicing slices

If we already have a slice, there is no need to get another full-range slice from that, just use the original.
clippy::redundant_slicing
This commit is contained in:
Matthias Krüger 2021-02-16 00:30:06 +01:00
parent d1206f950f
commit 4390a61b64
19 changed files with 33 additions and 40 deletions

View file

@ -671,7 +671,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
if !impl_candidates.is_empty() && e.span.contains(span) {
if let Some(expr) = exprs.first() {
if let ExprKind::Path(hir::QPath::Resolved(_, path)) = expr.kind {
if let [path_segment] = &path.segments[..] {
if let [path_segment] = path.segments {
let candidate_len = impl_candidates.len();
let suggestions = impl_candidates.iter().map(|candidate| {
format!(