mirror of
https://github.com/isar/rusqlite.git
synced 2025-12-18 01:12:25 +08:00
Use CStr::to_str where possible
This commit is contained in:
@@ -441,7 +441,8 @@ impl Statement<'_> {
|
||||
#[inline]
|
||||
pub fn parameter_name(&self, index: usize) -> Option<&'_ str> {
|
||||
self.stmt.bind_parameter_name(index as i32).map(|name| {
|
||||
str::from_utf8(name.to_bytes()).expect("Invalid UTF-8 sequence in parameter name")
|
||||
name.to_str()
|
||||
.expect("Invalid UTF-8 sequence in parameter name")
|
||||
})
|
||||
}
|
||||
|
||||
@@ -766,7 +767,7 @@ impl fmt::Debug for Statement<'_> {
|
||||
let sql = if self.stmt.is_null() {
|
||||
Ok("")
|
||||
} else {
|
||||
str::from_utf8(self.stmt.sql().unwrap().to_bytes())
|
||||
self.stmt.sql().unwrap().to_str()
|
||||
};
|
||||
f.debug_struct("Statement")
|
||||
.field("conn", self.conn)
|
||||
|
||||
Reference in New Issue
Block a user