1
Fork 0

[Clippy] Add vec_reserve & vecdeque_reserve diagnostic items

This commit is contained in:
wowinter13 2025-01-25 23:18:18 +01:00
parent f7cc13af82
commit 2117afdef8
3 changed files with 4 additions and 0 deletions

View file

@ -2186,8 +2186,10 @@ symbols! {
vec_macro,
vec_new,
vec_pop,
vec_reserve,
vec_with_capacity,
vecdeque_iter,
vecdeque_reserve,
vector,
version,
vfp2,

View file

@ -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");

View file

@ -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);
}