1
Fork 0
Empowering everyone to build reliable and efficient software. Gabriel's commits. https://www.rust-lang.org/
Find a file
Guillaume Boisseau cc7edbc1e4
Rollup merge of #120479 - estebank:issue-61788, r=wesleywiser
Suggest turning `if let` into irrefutable `let` if appropriate

When encountering an `if let` tail expression without an `else` arm for an enum with a single variant, suggest writing an irrefutable `let` binding instead.

```
error[E0317]: `if` may be missing an `else` clause
  --> $DIR/irrefutable-if-let-without-else.rs:8:5
   |
LL |   fn foo(x: Enum) -> i32 {
   |                      --- expected `i32` because of this return type
LL | /     if let Enum::Variant(value) = x {
LL | |         value
LL | |     }
   | |_____^ expected `i32`, found `()`
   |
   = note: `if` expressions without `else` evaluate to `()`
   = help: consider adding an `else` block that evaluates to the expected type
help: consider using an irrefutable `let` binding instead
   |
LL ~     let Enum::Variant(value) = x;
LL ~         value
   |
```

Fix #61788.
2024-02-07 18:24:43 +01:00
.github Use new publicly-available M1 runners 2024-02-04 13:52:05 -05:00
.reuse
compiler Rollup merge of #120479 - estebank:issue-61788, r=wesleywiser 2024-02-07 18:24:43 +01:00
library Auto merge of #120527 - GnomedDev:atomicu32-handle, r=petrochenkov 2024-02-07 11:57:50 +00:00
LICENSES
src Rollup merge of #119162 - heiher:direct-access-external-data, r=petrochenkov 2024-02-07 18:24:41 +01:00
tests Rollup merge of #120479 - estebank:issue-61788, r=wesleywiser 2024-02-07 18:24:43 +01:00
.editorconfig
.git-blame-ignore-revs
.gitattributes
.gitignore
.gitmodules
.mailmap
Cargo.lock Auto merge of #120326 - tmandry:abort-in-tests, r=cuviper 2024-02-06 04:15:41 +00:00
Cargo.toml Bump rustc_index and rustc_abi 2024-02-02 09:00:21 +02:00
CODE_OF_CONDUCT.md
config.example.toml
configure
CONTRIBUTING.md
COPYRIGHT
INSTALL.md
LICENSE-APACHE
LICENSE-MIT
README.md
RELEASES.md Release notes for 1.76 2024-02-03 13:38:44 -05:00
rust-bors.toml
rustfmt.toml
triagebot.toml Remove b-naber from the compiler review rotation 2024-02-06 00:37:57 +01:00
x
x.ps1
x.py

The Rust Programming Language

Rust Community

This is the main source code repository for Rust. It contains the compiler, standard library, and documentation.

Note: this README is for users rather than contributors. If you wish to contribute to the compiler, you should read CONTRIBUTING.md instead.

Table of Contents

Quick Start

Read "Installation" from The Book.

Installing from Source

If you really want to install from source (though this is not recommended), see INSTALL.md.

Getting Help

See https://www.rust-lang.org/community for a list of chat platforms and forums.

Contributing

See CONTRIBUTING.md.

License

Rust is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.

See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.

Trademark

The Rust Foundation owns and protects the Rust and Cargo trademarks and logos (the "Rust Trademarks").

If you want to use these names or brands, please read the media guide.

Third-party logos may be subject to third-party copyrights and trademarks. See Licenses for details.