Skip to content

Commit eaa03ea

Browse files
committed
Auto merge of rust-lang#8972 - kyoto7250:use_retain, r=llogiq
feat(new lint): new lint `manual_retain` close rust-lang#8097 This PR is a new lint implementation. This lint checks if the `retain` method is available. Thank you in advance. changelog: add new ``[`manual_retain`]`` lint
2 parents 889b361 + 676af45 commit eaa03ea

13 files changed

+859
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3528,6 +3528,7 @@ Released 2018-09-13
35283528
[`manual_ok_or`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_or
35293529
[`manual_range_contains`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_range_contains
35303530
[`manual_rem_euclid`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_rem_euclid
3531+
[`manual_retain`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_retain
35313532
[`manual_saturating_arithmetic`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_saturating_arithmetic
35323533
[`manual_split_once`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_split_once
35333534
[`manual_str_repeat`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_str_repeat

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
A collection of lints to catch common mistakes and improve your [Rust](https://github.com/rust-lang/rust) code.
77

8-
[There are over 500 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
8+
[There are over 550 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
99

1010
Lints are divided into categories, each with a default [lint level](https://doc.rust-lang.org/rustc/lints/levels.html).
1111
You can choose how much Clippy is supposed to ~~annoy~~ help you by changing the lint level by category.

book/src/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
A collection of lints to catch common mistakes and improve your
77
[Rust](https://github.com/rust-lang/rust) code.
88

9-
[There are over 500 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
9+
[There are over 550 lints included in this crate!](https://rust-lang.github.io/rust-clippy/master/index.html)
1010

1111
Lints are divided into categories, each with a default [lint
1212
level](https://doc.rust-lang.org/rustc/lints/levels.html). You can choose how

clippy_lints/src/lib.register_all.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
136136
LintId::of(manual_bits::MANUAL_BITS),
137137
LintId::of(manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE),
138138
LintId::of(manual_rem_euclid::MANUAL_REM_EUCLID),
139+
LintId::of(manual_retain::MANUAL_RETAIN),
139140
LintId::of(manual_strip::MANUAL_STRIP),
140141
LintId::of(map_clone::MAP_CLONE),
141142
LintId::of(map_unit_fn::OPTION_MAP_UNIT_FN),

clippy_lints/src/lib.register_lints.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ store.register_lints(&[
257257
manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE,
258258
manual_ok_or::MANUAL_OK_OR,
259259
manual_rem_euclid::MANUAL_REM_EUCLID,
260+
manual_retain::MANUAL_RETAIN,
260261
manual_strip::MANUAL_STRIP,
261262
map_clone::MAP_CLONE,
262263
map_err_ignore::MAP_ERR_IGNORE,

clippy_lints/src/lib.register_perf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ store.register_group(true, "clippy::perf", Some("clippy_perf"), vec![
1313
LintId::of(loops::MANUAL_MEMCPY),
1414
LintId::of(loops::MISSING_SPIN_LOOP),
1515
LintId::of(loops::NEEDLESS_COLLECT),
16+
LintId::of(manual_retain::MANUAL_RETAIN),
1617
LintId::of(methods::EXPECT_FUN_CALL),
1718
LintId::of(methods::EXTEND_WITH_DRAIN),
1819
LintId::of(methods::ITER_NTH),

clippy_lints/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ mod manual_bits;
283283
mod manual_non_exhaustive;
284284
mod manual_ok_or;
285285
mod manual_rem_euclid;
286+
mod manual_retain;
286287
mod manual_strip;
287288
mod map_clone;
288289
mod map_err_ignore;
@@ -914,6 +915,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
914915
store.register_late_pass(|| Box::new(read_zero_byte_vec::ReadZeroByteVec));
915916
store.register_late_pass(|| Box::new(default_instead_of_iter_empty::DefaultIterEmpty));
916917
store.register_late_pass(move || Box::new(manual_rem_euclid::ManualRemEuclid::new(msrv)));
918+
store.register_late_pass(move || Box::new(manual_retain::ManualRetain::new(msrv)));
917919
// add lints here, do not remove this comment, it's used in `new_lint`
918920
}
919921

clippy_lints/src/manual_retain.rs

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
use clippy_utils::diagnostics::span_lint_and_sugg;
2+
use clippy_utils::source::snippet;
3+
use clippy_utils::ty::is_type_diagnostic_item;
4+
use clippy_utils::{get_parent_expr, match_def_path, paths, SpanlessEq};
5+
use clippy_utils::{meets_msrv, msrvs};
6+
use rustc_errors::Applicability;
7+
use rustc_hir as hir;
8+
use rustc_hir::def_id::DefId;
9+
use rustc_hir::ExprKind::Assign;
10+
use rustc_lint::{LateContext, LateLintPass};
11+
use rustc_semver::RustcVersion;
12+
use rustc_session::{declare_tool_lint, impl_lint_pass};
13+
use rustc_span::symbol::sym;
14+
15+
const ACCEPTABLE_METHODS: [&[&str]; 4] = [
16+
&paths::HASHSET_ITER,
17+
&paths::BTREESET_ITER,
18+
&paths::SLICE_INTO,
19+
&paths::VEC_DEQUE_ITER,
20+
];
21+
const ACCEPTABLE_TYPES: [(rustc_span::Symbol, Option<RustcVersion>); 6] = [
22+
(sym::BTreeSet, Some(msrvs::BTREE_SET_RETAIN)),
23+
(sym::BTreeMap, Some(msrvs::BTREE_MAP_RETAIN)),
24+
(sym::HashSet, Some(msrvs::HASH_SET_RETAIN)),
25+
(sym::HashMap, Some(msrvs::HASH_MAP_RETAIN)),
26+
(sym::Vec, None),
27+
(sym::VecDeque, None),
28+
];
29+
30+
declare_clippy_lint! {
31+
/// ### What it does
32+
/// Checks for code to be replaced by `.retain()`.
33+
/// ### Why is this bad?
34+
/// `.retain()` is simpler and avoids needless allocation.
35+
/// ### Example
36+
/// ```rust
37+
/// let mut vec = vec![0, 1, 2];
38+
/// vec = vec.iter().filter(|&x| x % 2 == 0).copied().collect();
39+
/// vec = vec.into_iter().filter(|x| x % 2 == 0).collect();
40+
/// ```
41+
/// Use instead:
42+
/// ```rust
43+
/// let mut vec = vec![0, 1, 2];
44+
/// vec.retain(|x| x % 2 == 0);
45+
/// ```
46+
#[clippy::version = "1.63.0"]
47+
pub MANUAL_RETAIN,
48+
perf,
49+
"`retain()` is simpler and the same functionalitys"
50+
}
51+
52+
pub struct ManualRetain {
53+
msrv: Option<RustcVersion>,
54+
}
55+
56+
impl ManualRetain {
57+
#[must_use]
58+
pub fn new(msrv: Option<RustcVersion>) -> Self {
59+
Self { msrv }
60+
}
61+
}
62+
63+
impl_lint_pass!(ManualRetain => [MANUAL_RETAIN]);
64+
65+
impl<'tcx> LateLintPass<'tcx> for ManualRetain {
66+
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
67+
if let Some(parent_expr) = get_parent_expr(cx, expr)
68+
&& let Assign(left_expr, collect_expr, _) = &parent_expr.kind
69+
&& let hir::ExprKind::MethodCall(seg, _, _) = &collect_expr.kind
70+
&& seg.args.is_none()
71+
&& let hir::ExprKind::MethodCall(_, [target_expr], _) = &collect_expr.kind
72+
&& let Some(collect_def_id) = cx.typeck_results().type_dependent_def_id(collect_expr.hir_id)
73+
&& match_def_path(cx, collect_def_id, &paths::CORE_ITER_COLLECT) {
74+
check_into_iter(cx, parent_expr, left_expr, target_expr, self.msrv);
75+
check_iter(cx, parent_expr, left_expr, target_expr, self.msrv);
76+
check_to_owned(cx, parent_expr, left_expr, target_expr, self.msrv);
77+
}
78+
}
79+
80+
extract_msrv_attr!(LateContext);
81+
}
82+
83+
fn check_into_iter(
84+
cx: &LateContext<'_>,
85+
parent_expr: &hir::Expr<'_>,
86+
left_expr: &hir::Expr<'_>,
87+
target_expr: &hir::Expr<'_>,
88+
msrv: Option<RustcVersion>,
89+
) {
90+
if let hir::ExprKind::MethodCall(_, [into_iter_expr, _], _) = &target_expr.kind
91+
&& let Some(filter_def_id) = cx.typeck_results().type_dependent_def_id(target_expr.hir_id)
92+
&& match_def_path(cx, filter_def_id, &paths::CORE_ITER_FILTER)
93+
&& let hir::ExprKind::MethodCall(_, [struct_expr], _) = &into_iter_expr.kind
94+
&& let Some(into_iter_def_id) = cx.typeck_results().type_dependent_def_id(into_iter_expr.hir_id)
95+
&& match_def_path(cx, into_iter_def_id, &paths::CORE_ITER_INTO_ITER)
96+
&& match_acceptable_type(cx, left_expr, msrv)
97+
&& SpanlessEq::new(cx).eq_expr(left_expr, struct_expr) {
98+
suggest(cx, parent_expr, left_expr, target_expr);
99+
}
100+
}
101+
102+
fn check_iter(
103+
cx: &LateContext<'_>,
104+
parent_expr: &hir::Expr<'_>,
105+
left_expr: &hir::Expr<'_>,
106+
target_expr: &hir::Expr<'_>,
107+
msrv: Option<RustcVersion>,
108+
) {
109+
if let hir::ExprKind::MethodCall(_, [filter_expr], _) = &target_expr.kind
110+
&& let Some(copied_def_id) = cx.typeck_results().type_dependent_def_id(target_expr.hir_id)
111+
&& (match_def_path(cx, copied_def_id, &paths::CORE_ITER_COPIED)
112+
|| match_def_path(cx, copied_def_id, &paths::CORE_ITER_CLONED))
113+
&& let hir::ExprKind::MethodCall(_, [iter_expr, _], _) = &filter_expr.kind
114+
&& let Some(filter_def_id) = cx.typeck_results().type_dependent_def_id(filter_expr.hir_id)
115+
&& match_def_path(cx, filter_def_id, &paths::CORE_ITER_FILTER)
116+
&& let hir::ExprKind::MethodCall(_, [struct_expr], _) = &iter_expr.kind
117+
&& let Some(iter_expr_def_id) = cx.typeck_results().type_dependent_def_id(iter_expr.hir_id)
118+
&& match_acceptable_def_path(cx, iter_expr_def_id)
119+
&& match_acceptable_type(cx, left_expr, msrv)
120+
&& SpanlessEq::new(cx).eq_expr(left_expr, struct_expr) {
121+
suggest(cx, parent_expr, left_expr, filter_expr);
122+
}
123+
}
124+
125+
fn check_to_owned(
126+
cx: &LateContext<'_>,
127+
parent_expr: &hir::Expr<'_>,
128+
left_expr: &hir::Expr<'_>,
129+
target_expr: &hir::Expr<'_>,
130+
msrv: Option<RustcVersion>,
131+
) {
132+
if meets_msrv(msrv, msrvs::STRING_RETAIN)
133+
&& let hir::ExprKind::MethodCall(_, [filter_expr], _) = &target_expr.kind
134+
&& let Some(to_owned_def_id) = cx.typeck_results().type_dependent_def_id(target_expr.hir_id)
135+
&& match_def_path(cx, to_owned_def_id, &paths::TO_OWNED_METHOD)
136+
&& let hir::ExprKind::MethodCall(_, [chars_expr, _], _) = &filter_expr.kind
137+
&& let Some(filter_def_id) = cx.typeck_results().type_dependent_def_id(filter_expr.hir_id)
138+
&& match_def_path(cx, filter_def_id, &paths::CORE_ITER_FILTER)
139+
&& let hir::ExprKind::MethodCall(_, [str_expr], _) = &chars_expr.kind
140+
&& let Some(chars_expr_def_id) = cx.typeck_results().type_dependent_def_id(chars_expr.hir_id)
141+
&& match_def_path(cx, chars_expr_def_id, &paths::STR_CHARS)
142+
&& let ty = cx.typeck_results().expr_ty(str_expr).peel_refs()
143+
&& is_type_diagnostic_item(cx, ty, sym::String)
144+
&& SpanlessEq::new(cx).eq_expr(left_expr, str_expr) {
145+
suggest(cx, parent_expr, left_expr, filter_expr);
146+
}
147+
}
148+
149+
fn suggest(cx: &LateContext<'_>, parent_expr: &hir::Expr<'_>, left_expr: &hir::Expr<'_>, filter_expr: &hir::Expr<'_>) {
150+
if let hir::ExprKind::MethodCall(_, [_, closure], _) = filter_expr.kind
151+
&& let hir::ExprKind::Closure{ body, ..} = closure.kind
152+
&& let filter_body = cx.tcx.hir().body(body)
153+
&& let [filter_params] = filter_body.params
154+
&& let Some(sugg) = match filter_params.pat.kind {
155+
hir::PatKind::Binding(_, _, filter_param_ident, None) => {
156+
Some(format!("{}.retain(|{}| {})", snippet(cx, left_expr.span, ".."), filter_param_ident, snippet(cx, filter_body.value.span, "..")))
157+
},
158+
hir::PatKind::Tuple([key_pat, value_pat], _) => {
159+
make_sugg(cx, key_pat, value_pat, left_expr, filter_body)
160+
},
161+
hir::PatKind::Ref(pat, _) => {
162+
match pat.kind {
163+
hir::PatKind::Binding(_, _, filter_param_ident, None) => {
164+
Some(format!("{}.retain(|{}| {})", snippet(cx, left_expr.span, ".."), filter_param_ident, snippet(cx, filter_body.value.span, "..")))
165+
},
166+
_ => None
167+
}
168+
},
169+
_ => None
170+
} {
171+
span_lint_and_sugg(
172+
cx,
173+
MANUAL_RETAIN,
174+
parent_expr.span,
175+
"this expression can be written more simply using `.retain()`",
176+
"consider calling `.retain()` instead",
177+
sugg,
178+
Applicability::MachineApplicable
179+
);
180+
}
181+
}
182+
183+
fn make_sugg(
184+
cx: &LateContext<'_>,
185+
key_pat: &rustc_hir::Pat<'_>,
186+
value_pat: &rustc_hir::Pat<'_>,
187+
left_expr: &hir::Expr<'_>,
188+
filter_body: &hir::Body<'_>,
189+
) -> Option<String> {
190+
match (&key_pat.kind, &value_pat.kind) {
191+
(hir::PatKind::Binding(_, _, key_param_ident, None), hir::PatKind::Binding(_, _, value_param_ident, None)) => {
192+
Some(format!(
193+
"{}.retain(|{}, &mut {}| {})",
194+
snippet(cx, left_expr.span, ".."),
195+
key_param_ident,
196+
value_param_ident,
197+
snippet(cx, filter_body.value.span, "..")
198+
))
199+
},
200+
(hir::PatKind::Binding(_, _, key_param_ident, None), hir::PatKind::Wild) => Some(format!(
201+
"{}.retain(|{}, _| {})",
202+
snippet(cx, left_expr.span, ".."),
203+
key_param_ident,
204+
snippet(cx, filter_body.value.span, "..")
205+
)),
206+
(hir::PatKind::Wild, hir::PatKind::Binding(_, _, value_param_ident, None)) => Some(format!(
207+
"{}.retain(|_, &mut {}| {})",
208+
snippet(cx, left_expr.span, ".."),
209+
value_param_ident,
210+
snippet(cx, filter_body.value.span, "..")
211+
)),
212+
_ => None,
213+
}
214+
}
215+
216+
fn match_acceptable_def_path(cx: &LateContext<'_>, collect_def_id: DefId) -> bool {
217+
ACCEPTABLE_METHODS
218+
.iter()
219+
.any(|&method| match_def_path(cx, collect_def_id, method))
220+
}
221+
222+
fn match_acceptable_type(cx: &LateContext<'_>, expr: &hir::Expr<'_>, msrv: Option<RustcVersion>) -> bool {
223+
let expr_ty = cx.typeck_results().expr_ty(expr).peel_refs();
224+
ACCEPTABLE_TYPES.iter().any(|(ty, acceptable_msrv)| {
225+
is_type_diagnostic_item(cx, expr_ty, *ty)
226+
&& acceptable_msrv.map_or(true, |acceptable_msrv| meets_msrv(msrv, acceptable_msrv))
227+
})
228+
}

clippy_utils/src/msrvs.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ macro_rules! msrv_aliases {
1212

1313
// names may refer to stabilized feature flags or library items
1414
msrv_aliases! {
15-
1,53,0 { OR_PATTERNS, MANUAL_BITS }
15+
1,53,0 { OR_PATTERNS, MANUAL_BITS, BTREE_MAP_RETAIN, BTREE_SET_RETAIN }
1616
1,52,0 { STR_SPLIT_ONCE, REM_EUCLID_CONST }
1717
1,51,0 { BORROW_AS_PTR, UNSIGNED_ABS }
1818
1,50,0 { BOOL_THEN }
@@ -30,7 +30,8 @@ msrv_aliases! {
3030
1,34,0 { TRY_FROM }
3131
1,30,0 { ITERATOR_FIND_MAP, TOOL_ATTRIBUTES }
3232
1,28,0 { FROM_BOOL }
33-
1,26,0 { RANGE_INCLUSIVE }
33+
1,26,0 { RANGE_INCLUSIVE, STRING_RETAIN }
34+
1,18,0 { HASH_MAP_RETAIN, HASH_SET_RETAIN }
3435
1,17,0 { FIELD_INIT_SHORTHAND, STATIC_IN_CONST, EXPECT_ERR }
3536
1,16,0 { STR_REPEAT }
3637
1,24,0 { IS_ASCII_DIGIT }

clippy_utils/src/paths.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,14 @@ pub const ASREF_TRAIT: [&str; 3] = ["core", "convert", "AsRef"];
2121
pub const BTREEMAP_CONTAINS_KEY: [&str; 6] = ["alloc", "collections", "btree", "map", "BTreeMap", "contains_key"];
2222
pub const BTREEMAP_ENTRY: [&str; 6] = ["alloc", "collections", "btree", "map", "entry", "Entry"];
2323
pub const BTREEMAP_INSERT: [&str; 6] = ["alloc", "collections", "btree", "map", "BTreeMap", "insert"];
24+
pub const BTREESET_ITER: [&str; 6] = ["alloc", "collections", "btree", "set", "BTreeSet", "iter"];
2425
pub const CLONE_TRAIT_METHOD: [&str; 4] = ["core", "clone", "Clone", "clone"];
2526
pub const COW: [&str; 3] = ["alloc", "borrow", "Cow"];
27+
pub const CORE_ITER_COLLECT: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "collect"];
28+
pub const CORE_ITER_CLONED: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "cloned"];
29+
pub const CORE_ITER_COPIED: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "copied"];
30+
pub const CORE_ITER_FILTER: [&str; 6] = ["core", "iter", "traits", "iterator", "Iterator", "filter"];
31+
pub const CORE_ITER_INTO_ITER: [&str; 6] = ["core", "iter", "traits", "collect", "IntoIterator", "into_iter"];
2632
pub const CSTRING_AS_C_STR: [&str; 5] = ["alloc", "ffi", "c_str", "CString", "as_c_str"];
2733
pub const DEFAULT_TRAIT_METHOD: [&str; 4] = ["core", "default", "Default", "default"];
2834
pub const DEREF_MUT_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "DerefMut", "deref_mut"];
@@ -50,6 +56,7 @@ pub const FUTURES_IO_ASYNCWRITEEXT: [&str; 3] = ["futures_util", "io", "AsyncWri
5056
pub const HASHMAP_CONTAINS_KEY: [&str; 6] = ["std", "collections", "hash", "map", "HashMap", "contains_key"];
5157
pub const HASHMAP_ENTRY: [&str; 5] = ["std", "collections", "hash", "map", "Entry"];
5258
pub const HASHMAP_INSERT: [&str; 6] = ["std", "collections", "hash", "map", "HashMap", "insert"];
59+
pub const HASHSET_ITER: [&str; 6] = ["std", "collections", "hash", "set", "HashSet", "iter"];
5360
#[cfg(feature = "internal")]
5461
pub const IDENT: [&str; 3] = ["rustc_span", "symbol", "Ident"];
5562
#[cfg(feature = "internal")]
@@ -143,6 +150,7 @@ pub const SLICE_FROM_RAW_PARTS: [&str; 4] = ["core", "slice", "raw", "from_raw_p
143150
pub const SLICE_FROM_RAW_PARTS_MUT: [&str; 4] = ["core", "slice", "raw", "from_raw_parts_mut"];
144151
pub const SLICE_GET: [&str; 4] = ["core", "slice", "<impl [T]>", "get"];
145152
pub const SLICE_INTO_VEC: [&str; 4] = ["alloc", "slice", "<impl [T]>", "into_vec"];
153+
pub const SLICE_INTO: [&str; 4] = ["core", "slice", "<impl [T]>", "iter"];
146154
pub const SLICE_ITER: [&str; 4] = ["core", "slice", "iter", "Iter"];
147155
pub const STDERR: [&str; 4] = ["std", "io", "stdio", "stderr"];
148156
pub const STDOUT: [&str; 4] = ["std", "io", "stdio", "stdout"];
@@ -152,6 +160,7 @@ pub const STRING_AS_MUT_STR: [&str; 4] = ["alloc", "string", "String", "as_mut_s
152160
pub const STRING_AS_STR: [&str; 4] = ["alloc", "string", "String", "as_str"];
153161
pub const STRING_NEW: [&str; 4] = ["alloc", "string", "String", "new"];
154162
pub const STR_BYTES: [&str; 4] = ["core", "str", "<impl str>", "bytes"];
163+
pub const STR_CHARS: [&str; 4] = ["core", "str", "<impl str>", "chars"];
155164
pub const STR_ENDS_WITH: [&str; 4] = ["core", "str", "<impl str>", "ends_with"];
156165
pub const STR_FROM_UTF8: [&str; 4] = ["core", "str", "converts", "from_utf8"];
157166
pub const STR_LEN: [&str; 4] = ["core", "str", "<impl str>", "len"];
@@ -177,6 +186,7 @@ pub const TOKIO_IO_ASYNCWRITEEXT: [&str; 5] = ["tokio", "io", "util", "async_wri
177186
pub const TRY_FROM: [&str; 4] = ["core", "convert", "TryFrom", "try_from"];
178187
pub const VEC_AS_MUT_SLICE: [&str; 4] = ["alloc", "vec", "Vec", "as_mut_slice"];
179188
pub const VEC_AS_SLICE: [&str; 4] = ["alloc", "vec", "Vec", "as_slice"];
189+
pub const VEC_DEQUE_ITER: [&str; 5] = ["alloc", "collections", "vec_deque", "VecDeque", "iter"];
180190
pub const VEC_FROM_ELEM: [&str; 3] = ["alloc", "vec", "from_elem"];
181191
pub const VEC_NEW: [&str; 4] = ["alloc", "vec", "Vec", "new"];
182192
pub const VEC_RESIZE: [&str; 4] = ["alloc", "vec", "Vec", "resize"];

0 commit comments

Comments
 (0)