Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-29455

rust-analyzer clippy option doesn't work

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • Qt Creator 11.0.0, Qt Creator 12.0.2, Qt Creator 13.0.0, Qt Creator 14.0.0
    • None
    • Linux/X11

    Description

      You can apparently enable clippy(lints) support by apparently supplying(in vscode it's configured via setting "rust-analyzer.checkOnSave.command": "clippy")

      { "checkOnSave": 

      { "command": "clippy" }

      , "check": { "command": "clippy" } }

      In options. And this seems to work, as creator popup says "cargo clippy", instead of "cargo check", which is exactly how clippy in rust-analyzer is supposed to be invoked. However, i get

      LanguageClient rust for rust: Error: cargo check failed

      In my general log, and no lints are displayed. Warnings are displayed as normal.

       

      Minimal example to reproduce this is

      // code placeholder
      #![warn(clippy::all)]
      fn find(s: &str, f: impl Fn(char) -> bool) -> usize {
          s.find(f).unwrap_or_else(|| s.len())
      }
      fn main() {}

      Should warn about "unwrap_or_else"

       

      You can check that by manually running cargo clippy.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            davschul David Schulz
            anomalocaris Alex Drozdov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes