feat: replace unmaintained winapi with windows-sys#18
feat: replace unmaintained winapi with windows-sys#18joaomoreno merged 4 commits intomicrosoft:mainfrom
Conversation
winapi has been unmaintained for a long time this commit replaces winapi with windows-sys which is generated from windows API headers and maintained by Microsoft
|
@joaomoreno what's the proper way to test all functionality? |
|
I've also tried to maintain preexisting style of codebase and added rustfmt config that preserves it |
|
I'm also not sure what Rust version you use (CI seems to use stable) so I've updated code to latest rust compatibility (1.64, it will fail for anything older) |
Feel free to submit a different PR which brings in rustfmt with more modern rules. |
The win32 specific part is purely related to GUI, so manual testing with |
I wouldn't say that there are any modern rules 😅 it's just what rustfmt does as default (using spaces instead of tabs) |
src/main.rs
Outdated
| directories.push_back(root); | ||
|
|
||
| while directories.len() > 0 { | ||
| while directories.is_empty() { |
| let msg = format!( | ||
| "Failed to install Visual Studio Code update. | ||
| Updates may fail due to anti-virus software and/or runaway processes. Please try restarting your machine before attempting to update again. | ||
| Please read the log file for more information: | ||
| {log_path}" | ||
| ); |
There was a problem hiding this comment.
This will add weird indentation to the message.
src/process.rs
Outdated
|
|
||
| pe32.dwSize = mem::size_of::<PROCESSENTRY32W>() as u32; | ||
|
|
||
| if Process32FirstW(handle, &mut pe32).is_negative() { |
There was a problem hiding this comment.
This breaks the logic: BOOL is 1 for true and 0 for false, while is_negative() catches neither case.
src/process.rs
Outdated
| id: pe32.th32ProcessID, | ||
| }); | ||
|
|
||
| if Process32NextW(handle, &mut pe32).is_negative() { |
There was a problem hiding this comment.
This breaks the logic: BOOL is 1 for true and 0 for false, while is_negative() catches neither case.

winapi has been unmaintained for a long time
this commit replaces winapi with windows-sys which is generated from windows API headers and maintained by Microsoft
apart from that, codebase has been fixed from few clippy lints and errors
winapi is still an indirect dependency via: