diff --git a/src/os/windows/mod.rs b/src/os/windows/mod.rs index 9d1d985..be28e26 100644 --- a/src/os/windows/mod.rs +++ b/src/os/windows/mod.rs @@ -26,9 +26,7 @@ impl Library { /// Corresponds to `LoadLibraryW(filename)`. #[inline] pub fn new>(filename: P) -> ::Result { - let mut wide_filename: Vec = filename.as_ref().encode_wide().collect(); - wide_filename.push(0); - wide_filename.shrink_to_fit(); + let mut wide_filename: Vec = filename.as_ref().encode_wide().chain(Some(0)).collect(); let _guard = ErrorModeGuard::new(); let ret = with_get_last_error(|| {