Skip to content

Commit

Permalink
Auto merge of #11430 - TDecking:vec-fmt, r=giraffate
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors committed Sep 1, 2023
2 parents 79c684d + 1f8b204 commit c1f8ae3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/methods/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3055,12 +3055,12 @@ declare_clippy_lint! {
///
/// ### 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,
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/unit_return_expecting_ord.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ declare_clippy_lint! {
///
/// ### 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"]
Expand Down

0 comments on commit c1f8ae3

Please sign in to comment.