Move let_cxx_string's $value evaluation outside of unsafe block

This commit is contained in:
David Tolnay 2020-12-27 21:45:33 -08:00
parent fe67bf4b6a
commit c4a3ede519
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -73,7 +73,9 @@ macro_rules! let_cxx_string {
($var:ident = $value:expr $(,)?) => {
let mut $var = $crate::private::StackString::new();
#[allow(unused_mut, unused_unsafe)]
let mut $var = unsafe { $var.init($value) };
let mut $var = match $value {
let_cxx_string => unsafe { $var.init(let_cxx_string) },
};
};
}