mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-24 05:33:27 +00:00
Add .front()
to get_first
lint description
This commit is contained in:
parent
eca3932395
commit
457ab585fc
1 changed files with 4 additions and 4 deletions
|
@ -2590,11 +2590,11 @@ declare_clippy_lint! {
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// ### What it does
|
/// ### What it does
|
||||||
/// Checks for usage of `x.get(0)` instead of
|
/// Checks for usage of `x.get(0)` instead of
|
||||||
/// `x.first()`.
|
/// `x.first()` or `x.front()`.
|
||||||
///
|
///
|
||||||
/// ### Why is this bad?
|
/// ### Why is this bad?
|
||||||
/// Using `x.first()` is easier to read and has the same
|
/// Using `x.first()` for `Vec`s and slices or `x.front()`
|
||||||
/// result.
|
/// for `VecDeque`s is easier to read and has the same result.
|
||||||
///
|
///
|
||||||
/// ### Example
|
/// ### Example
|
||||||
/// ```no_run
|
/// ```no_run
|
||||||
|
@ -2610,7 +2610,7 @@ declare_clippy_lint! {
|
||||||
#[clippy::version = "1.63.0"]
|
#[clippy::version = "1.63.0"]
|
||||||
pub GET_FIRST,
|
pub GET_FIRST,
|
||||||
style,
|
style,
|
||||||
"Using `x.get(0)` when `x.first()` is simpler"
|
"Using `x.get(0)` when `x.first()` or `x.front()` is simpler"
|
||||||
}
|
}
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
|
|
Loading…
Reference in a new issue