Skip to content

Commit f4dd846

Browse files
committed
Fix BnString usage of as_ref instead of as_str
Fixes `BnString::len` and `BnString::is_empty` incorrectly reporting 1 and true on empty null terminated string.
1 parent 7d70a15 commit f4dd846

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rust/src/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ impl BnString {
101101
}
102102

103103
pub fn len(&self) -> usize {
104-
self.as_ref().len()
104+
self.as_str().len()
105105
}
106106

107107
pub fn is_empty(&self) -> bool {
108-
self.as_ref().is_empty()
108+
self.as_str().is_empty()
109109
}
110110
}
111111

0 commit comments

Comments
 (0)