Skip to content

Commit

Permalink
[Clippy] Add vec_reserve & vecdeque_reserve diagnostic items
Browse files Browse the repository at this point in the history
  • Loading branch information
wowinter13 authored and gitbot committed Feb 20, 2025
1 parent d70d068 commit a2da226
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions alloc/src/collections/vec_deque/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
/// assert!(buf.capacity() >= 11);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(not(test), rustc_diagnostic_item = "vecdeque_reserve")]
#[track_caller]
pub fn reserve(&mut self, additional: usize) {
let new_cap = self.len.checked_add(additional).expect("capacity overflow");
Expand Down
1 change: 1 addition & 0 deletions alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,7 @@ impl<T, A: Allocator> Vec<T, A> {
#[cfg(not(no_global_oom_handling))]
#[stable(feature = "rust1", since = "1.0.0")]
#[track_caller]
#[cfg_attr(not(test), rustc_diagnostic_item = "vec_reserve")]
pub fn reserve(&mut self, additional: usize) {
self.buf.reserve(self.len, additional);
}
Expand Down

0 comments on commit a2da226

Please sign in to comment.