-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Rust-analyzer warning
I am done with the rust-analyzer warning whenever i open the hvisor workspace.
So is there some methods to solve this warning? Or this is another configuration problem?
After examined the error log given by rust-analyzer, I found that the main reason causing the analyzer warning was that there were some problems happened in the building of build.rs, which caused the rust panic when building the build.rs, which resulted in warning of the analyzer.
The problem
The code causing the rust panic is as followed: https://github.com/syswonder/hvisor/blob/dev/build.rs#L143
This is just a instruction creating a symbol link per se. However, using expect to handle this function's return value is a bad idea.
Although we have to consider the possibility of failure of symbol link's creation, the most common error coming from creating symbol link is that there has been a file with the same name, which is exactly happening in hvisor:
thread 'main' panicked at build.rs:143:58:
Failed to create symlink: Os { code: 17, kind: AlreadyExists, message: "File exists" }
How to solve this problem
If you just delete the expect ,the warning of the rust analyzer will be gone. However, it's a better way to design a correct error handling logic to handle any error while creating a symbol link.