Auto merge of #11430 - TDecking:vec-fmt, r=giraffate

Correctly format `vec!` invocations

The [Rust Style Guide](https://doc.rust-lang.org/nightly/style-guide/expressions.html?highlight=vec#array-literals) says that `vec!` should alwys be used with square brackets, not parenthesis. Within the lint documentation, that rule was violated twice.

changelog: none
This commit is contained in:
bors 2023-09-01 00:03:26 +00:00
commit c1f8ae3a4a
2 changed files with 3 additions and 3 deletions

View File

@ -3055,12 +3055,12 @@
///
/// ### Example
/// ```rust
/// vec!(1, 2, 3, 4, 5).resize(0, 5)
/// vec![1, 2, 3, 4, 5].resize(0, 5)
/// ```
///
/// Use instead:
/// ```rust
/// vec!(1, 2, 3, 4, 5).clear()
/// vec![1, 2, 3, 4, 5].clear()
/// ```
#[clippy::version = "1.46.0"]
pub VEC_RESIZE_TO_ZERO,

View File

@ -26,7 +26,7 @@
///
/// ### Example
/// ```rust
/// let mut twins = vec!((1, 1), (2, 2));
/// let mut twins = vec![(1, 1), (2, 2)];
/// twins.sort_by_key(|x| { x.1; });
/// ```
#[clippy::version = "1.47.0"]