track_caller for capacity overflow panics

This commit is contained in:
Kornel
2023-04-10 22:45:18 +01:00
parent 0e131fd781
commit dc33f756d0
3 changed files with 11 additions and 0 deletions
+2
View File
@@ -201,6 +201,7 @@ impl<const CAP: usize> ArrayString<CAP>
///
/// assert_eq!(&string[..], "ab");
/// ```
#[track_caller]
pub fn push(&mut self, c: char) {
self.try_push(c).unwrap();
}
@@ -252,6 +253,7 @@ impl<const CAP: usize> ArrayString<CAP>
///
/// assert_eq!(&string[..], "ad");
/// ```
#[track_caller]
pub fn push_str(&mut self, s: &str) {
self.try_push_str(s).unwrap()
}