Skip to content

Commit c1f8ae3

Browse files
committed
Auto merge of rust-lang#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
2 parents 79c684d + 1f8b204 commit c1f8ae3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,12 +3055,12 @@ declare_clippy_lint! {
30553055
///
30563056
/// ### Example
30573057
/// ```rust
3058-
/// vec!(1, 2, 3, 4, 5).resize(0, 5)
3058+
/// vec![1, 2, 3, 4, 5].resize(0, 5)
30593059
/// ```
30603060
///
30613061
/// Use instead:
30623062
/// ```rust
3063-
/// vec!(1, 2, 3, 4, 5).clear()
3063+
/// vec![1, 2, 3, 4, 5].clear()
30643064
/// ```
30653065
#[clippy::version = "1.46.0"]
30663066
pub VEC_RESIZE_TO_ZERO,

clippy_lints/src/unit_return_expecting_ord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ declare_clippy_lint! {
2626
///
2727
/// ### Example
2828
/// ```rust
29-
/// let mut twins = vec!((1, 1), (2, 2));
29+
/// let mut twins = vec![(1, 1), (2, 2)];
3030
/// twins.sort_by_key(|x| { x.1; });
3131
/// ```
3232
#[clippy::version = "1.47.0"]

0 commit comments

Comments
 (0)