Giter Site home page Giter Site logo

Comments (3)

y21 avatar y21 commented on June 12, 2024

This lint already exists: https://rust-lang.github.io/rust-clippy/master/index.html#/manual_let_else

warning: this could be rewritten as `let...else`
  --> src/main.rs:10:3
   |
10 | /   let z = match x {
11 | |     Y(z) => z,
12 | |     _ => todo!()
13 | |   };
   | |____^ help: consider writing: `let Y(z) = x else { todo!() };`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

Since it's in the pedantic category, it's allowed by default and needs to be manually enabled.

from rust-clippy.

ltratt avatar ltratt commented on June 12, 2024

You're quite right! I've checked and this does fire on most (though not all, for reasons I haven't yet understood) instances of the idiom in our codebase. FWIW this lint doesn't feel pedantic to me, but maybe I'm biased.

from rust-clippy.

GuillaumeGomez avatar GuillaumeGomez commented on June 12, 2024

Then please open another issue to change the category. I think it should be in the style passes. Anyway, better to have an issue with a title related to what you suggest so you can attract more commenters. ;)

from rust-clippy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.