Skip to content

Commit 13af889

Browse files
committed
fix clippy error
1 parent f8f9ed7 commit 13af889

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4195,31 +4195,6 @@ declare_clippy_lint! {
41954195
"detect useless calls to `as_bytes()`"
41964196
}
41974197

4198-
declare_clippy_lint! {
4199-
/// ### What it does
4200-
/// Checks for usage of `.drain(x..)` for the sole purpose of truncating a container.
4201-
///
4202-
/// ### Why is this bad?
4203-
/// This creates an unnecessary iterator that is dropped immediately.
4204-
///
4205-
/// Calling `.truncate(x)` also makes the intent clearer.
4206-
///
4207-
/// ### Example
4208-
/// ```no_run
4209-
/// let mut v = vec![1, 2, 3];
4210-
/// v.drain(1..);
4211-
/// ```
4212-
/// Use instead:
4213-
/// ```no_run
4214-
/// let mut v = vec![1, 2, 3];
4215-
/// v.truncate(1);
4216-
/// ```
4217-
#[clippy::version = "1.84.0"]
4218-
pub TRUNCATE_WITH_DRAIN,
4219-
nursery,
4220-
"calling `drain` in order to truncate a `Vec`"
4221-
}
4222-
42234198
declare_clippy_lint! {
42244199
/// ### What it does
42254200
/// It detects useless calls to `str::as_bytes()` before calling `len()` or `is_empty()`.

clippy_lints/src/methods/truncate_with_drain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub fn is_range_open_ended<'a>(
6161
}
6262
},
6363
});
64-
return !start_is_none_or_min && end_is_none_or_max;
64+
!start_is_none_or_min && end_is_none_or_max
6565
}
6666

6767
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, span: Span, arg: Option<&Expr<'_>>) {

0 commit comments

Comments
 (0)