Skip to content
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

Rollup of 9 pull requests #101032

Closed
wants to merge 49 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
e540425
Add a `File::create_new` constructor
joshtriplett Jul 2, 2022
fab36d1
Add comments about stdout locking
sigaloid Jul 26, 2022
7b4cd17
Start uplifting `clippy::for_loops_over_fallibles`
WaffleLapkin Jul 17, 2022
810cf60
Use structured suggestions for `for_loop_over_fallibles` lint
WaffleLapkin Jul 18, 2022
b661157
`for_loop_over_fallibles`: Suggest removing `.next()`
WaffleLapkin Jul 24, 2022
7cf94ad
`for_loop_over_fallibles`: suggest `while let` loop
WaffleLapkin Jul 24, 2022
14b8f24
`for_loop_over_fallibles`: suggest using `?` in some cases
WaffleLapkin Jul 24, 2022
2bf213b
`for_loop_over_fallibles`: remove duplication from the message
WaffleLapkin Jul 24, 2022
5128140
Add a test for the `for_loop_over_fallibles` lint
WaffleLapkin Jul 24, 2022
34815a9
`for_loop_over_fallibles`: fix suggestion for "remove `.next()`" case
WaffleLapkin Jul 24, 2022
c4ab59e
`for_loop_over_fallibles`: don't use `MachineApplicable`
WaffleLapkin Jul 24, 2022
41fccb1
allow or avoid for loops over option in compiler and tests
WaffleLapkin Jul 26, 2022
86360f4
allow `for_loop_over_fallibles` in a `core` test
WaffleLapkin Jul 26, 2022
d7b8a65
Edit documentation for `for_loop_over_fallibles` lint
WaffleLapkin Aug 14, 2022
aed1ae4
remove an infinite loop
WaffleLapkin Aug 15, 2022
71b8c89
fix `for_loop_over_fallibles` lint docs
WaffleLapkin Aug 18, 2022
bafb10d
fix an outdated machine hook name
RalfJung Jul 27, 2022
d34df43
remove enforce_number_init machine hook that Miri no longer needs
RalfJung Jul 27, 2022
c542245
remove some now-unnecessary parameters from check_bytes
RalfJung Jul 27, 2022
8654522
make read_immediate error immediately on uninit, so ImmTy can carry i…
RalfJung Aug 1, 2022
c11fa89
remove now-unused ScalarMaybeUninit
RalfJung Aug 2, 2022
73ae38b
Migrate ast_lowering::path to SessionDiagnostic
JeanCASPAR Aug 16, 2022
0043d10
Migrate ast_lowering::lib and ast_lowering::item to SessionDiagnostic
JeanCASPAR Aug 17, 2022
1382d30
Migrate ast_lowering::expr to SessionDiagnostic
JeanCASPAR Aug 17, 2022
d75fd91
Migrate ast_lowering::ast to SessionDiagnostic
JeanCASPAR Aug 17, 2022
5164966
Migrate ast_lowering::pat to SessionDiagnostic
JeanCASPAR Aug 18, 2022
e701c72
Migrate all span_err(...) in ast_lowering to SessionDiagnostic
JeanCASPAR Aug 18, 2022
9472df1
Changes made in response to feedback
JeanCASPAR Aug 19, 2022
5fef1b8
Resolve conflicts
JeanCASPAR Aug 22, 2022
cb4cd73
extra sanity check against consts pointing to mutable memory
RalfJung Aug 23, 2022
36c42fa
Use `DisplayBuffer` for socket addresses.
reitermarkus Aug 16, 2022
63700a8
Add tests for `SockAddr` `Display`.
reitermarkus Aug 19, 2022
89c74e8
Move `net::parser` into `net::addr` module.
reitermarkus Aug 19, 2022
d61ecec
Flatten `net` module again.
reitermarkus Aug 24, 2022
4e97626
Call them constants instead of types
compiler-errors Aug 12, 2022
4ff5872
Note binding obligation causes for const equate errors
compiler-errors Aug 12, 2022
d464d3a
Add test for #100414
compiler-errors Aug 12, 2022
8189a45
Use ExprItemObligation and ExprBindingObligation too
compiler-errors Aug 23, 2022
252c65e
Fix clippy tests that trigger `for_loop_over_fallibles` lint
WaffleLapkin Aug 25, 2022
8c65478
rustdoc: remove unused CSS for `.variants_table`
notriddle Aug 25, 2022
fa68bb8
Rollup merge of #98801 - joshtriplett:file-create-new, r=thomcc
Dylan-DPC Aug 26, 2022
8ea7503
Rollup merge of #99696 - WaffleLapkin:uplift, r=fee1-dead
Dylan-DPC Aug 26, 2022
36d2301
Rollup merge of #99742 - sigaloid:master, r=thomcc
Dylan-DPC Aug 26, 2022
f68fd89
Rollup merge of #100043 - RalfJung:scalar-always-init, r=oli-obk
Dylan-DPC Aug 26, 2022
7bd551b
Rollup merge of #100437 - compiler-errors:better-const-mismatch-err, …
Dylan-DPC Aug 26, 2022
7059b42
Rollup merge of #100640 - reitermarkus:socket-display-buffer, r=thomcc
Dylan-DPC Aug 26, 2022
acad0ee
Rollup merge of #100724 - JeanCASPAR:migrate-ast_lowering-to-session-…
Dylan-DPC Aug 26, 2022
798732f
Rollup merge of #100897 - RalfJung:const-not-to-mutable, r=lcnr
Dylan-DPC Aug 26, 2022
f536cce
Rollup merge of #101012 - notriddle:notriddle/variants_table, r=jsha
Dylan-DPC Aug 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
for_loop_over_fallibles: suggest while let loop
  • Loading branch information
WaffleLapkin committed Aug 14, 2022
commit 7cf94ad91568cc1f2e94c0cca4987dc40aa4e452
10 changes: 10 additions & 0 deletions compiler/rustc_lint/src/for_loop_over_fallibles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ impl<'tcx> LateLintPass<'tcx> for ForLoopOverFallibles {
"",
Applicability::MaybeIncorrect
);
} else {
warn.multipart_suggestion_verbose(
format!("to check pattern in a loop use `while let`"),
vec![
// NB can't use `until` here because `expr.span` and `pat.span` have different syntax contexts
(expr.span.with_hi(pat.span.lo()), format!("while let {var}(")),
(pat.span.between(arg.span), format!(") = ")),
],
Applicability::MaybeIncorrect
);
}

warn.multipart_suggestion_verbose(
Expand Down