jetbrains-academy / rustlings-course

Small exercises to get you used to reading and writing Rust code!
https://github.com/rust-lang/rustlings/releases/tag/1.2.2
MIT License
149 stars 33 forks source link

Clippy marks question code as incorrect Understanding Ownership / What is ownership / Who Owns the One Ring #272

Closed edutools-service closed 1 year ago

edutools-service commented 1 year ago

With Clippy enabled, the IDE shows an error (red underline) for this section of code:

    let sam = frodo;
    let frodo = sam;

It complains that it looks like the code is trying to swap the two variables, and that I should use std::mem::replace instead. The check in the Description window continues to succeed as expected in spite of the error in the editor.

DaniilBogdanovJB commented 1 year ago

The problem was reproduced. Issue on YouTrack created: https://youtrack.jetbrains.com/issue/EDC-833/Rustling-Course-Understanding-Ownership-What-is-ownership-Who-Owns-the-One-Ring-Clippy-underlines-correct-answer