Skip to content

Commit

Permalink
Merge pull request #475 from ModProg/const-from_slice_unchecked
Browse files Browse the repository at this point in the history
Make from_slice_unchecked const
  • Loading branch information
diwic authored Jul 7, 2024
2 parents 4ff494e + e6f2234 commit 9bf455c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dbus/src/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<'m> $t<'m> {

/// This function creates a new instance of this struct, without checking.
/// It's up to you to guarantee that s ends with a \0 and is valid.
pub unsafe fn from_slice_unchecked(s: &'m str) -> $t<'m> {
pub const unsafe fn from_slice_unchecked(s: &'m str) -> $t<'m> {
let ss = s.as_bytes();
debug_assert!(ss[ss.len()-1] == 0);
$t(Cow::Borrowed(s))
Expand Down

0 comments on commit 9bf455c

Please sign in to comment.