-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mismatched type returned from log_file #26
Comments
I don't believe it should compile if Could you elaborate about the mismatched type warnings? This seems like it's possibly an error in the IDE that we could investigate. Provided your function returns a Fern's code does currently compile with no warnings from the rust compiler, and the example which uses |
I'm using CLion 2018.1.1 with macOS Sierra 10.12.6 Below is a screenshot of what appears in the CLion IDE: Below is screenshot of the lib.rs file with the log_file function that is called by my code: After writing all the above, I decided to set a breakpoint on the line of code that calls log_file, with it changed to the When I changed it back to When I changed it back to |
Hmm, it does seem to be some sort of ide error. The compiling output you show in your second screenshot is exactly what I'd expect if you change that code the way your PR did. It needs to return a Have you tried clearing all of CLion's caches and restarting? I'm 90% sure there should be an "invalidate caches & restart" option somewhere which could do this. If that doesn't fix it, there's probably some underlying bug in the rust plugin that needs to be reported at https://github.com/intellij-rust/intellij-rust? |
I just tried "File > Invalidate Caches / Restart" from the menu but it still shows the same warning. I tried changing lib.rs to |
Closing this as an IDE bug rather than a fern one. If there's anything else I can do to help resolve this, let me know. |
I'm using
fern = "0.5"
in Cargo.tomlWhen I use the sample code in CLion IDE, the line
.chain(fern::log_file("output.log")?)
displays warningmismatched types expected Result<File, Error>, found File
When I go modify the Fern library file fern-0.5.5/src/lib.rs and change the signature from
pub fn log_file<P: AsRef<Path>>(path: P) -> io::Result<File> {
topub fn log_file<P: AsRef<Path>>(path: P) -> File {
then the warning disappears, and the implementation still outputs to the log file and terminal successfully.The text was updated successfully, but these errors were encountered: