Use track_caller for panicking methods

This commit is contained in:
Kornel 2023-04-13 17:56:27 +01:00
parent ef4ae94799
commit b6bf62db14
2 changed files with 4 additions and 0 deletions

View File

@ -257,6 +257,7 @@ impl<'stmt> Row<'stmt> {
/// * If the underlying SQLite integral value is outside the range
/// representable by `T`
/// * If `idx` is outside the range of columns in the returned query
#[track_caller]
pub fn get_unwrap<I: RowIndex, T: FromSql>(&self, idx: I) -> T {
self.get(idx).unwrap()
}
@ -277,6 +278,7 @@ impl<'stmt> Row<'stmt> {
/// If the result type is i128 (which requires the `i128_blob` feature to be
/// enabled), and the underlying SQLite column is a blob whose size is not
/// 16 bytes, `Error::InvalidColumnType` will also be returned.
#[track_caller]
pub fn get<I: RowIndex, T: FromSql>(&self, idx: I) -> Result<T> {
let idx = idx.idx(self.stmt)?;
let value = self.stmt.value_ref(idx);
@ -335,6 +337,7 @@ impl<'stmt> Row<'stmt> {
///
/// * If `idx` is outside the range of columns in the returned query.
/// * If `idx` is not a valid column name for this row.
#[track_caller]
pub fn get_ref_unwrap<I: RowIndex>(&self, idx: I) -> ValueRef<'_> {
self.get_ref(idx).unwrap()
}

View File

@ -158,6 +158,7 @@ impl<'a> ValueRef<'a> {
impl From<ValueRef<'_>> for Value {
#[inline]
#[track_caller]
fn from(borrowed: ValueRef<'_>) -> Value {
match borrowed {
ValueRef::Null => Value::Null,