Commit fd53657
committed
auto merge of #18339 : chastell/rust/guide_pattern_fixes, r=nikomatsakis
I think it helps to show that the variables introduced in match blocks are indeed independent from the matched variable `x` (especially when `x` is still reachable inside those blocks and might be useful), so this renames them accordingly. Maybe some linter (or language-level warning?) will eventually warn about shadowing `x` in such cases. ;)
I’m not super happy about the matching-on-range example, as it’s too contrived (`e` and `x` are exactly the same here), but I couldn’t come up with something both simple and non-redundant.1 file changed
+8
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3852 | 3852 | | |
3853 | 3853 | | |
3854 | 3854 | | |
3855 | | - | |
| 3855 | + | |
3856 | 3856 | | |
3857 | 3857 | | |
3858 | 3858 | | |
| |||
3885 | 3885 | | |
3886 | 3886 | | |
3887 | 3887 | | |
3888 | | - | |
| 3888 | + | |
3889 | 3889 | | |
3890 | 3890 | | |
3891 | 3891 | | |
| |||
3898 | 3898 | | |
3899 | 3899 | | |
3900 | 3900 | | |
3901 | | - | |
| 3901 | + | |
3902 | 3902 | | |
3903 | 3903 | | |
3904 | 3904 | | |
3905 | | - | |
3906 | | - | |
| 3905 | + | |
| 3906 | + | |
3907 | 3907 | | |
3908 | 3908 | | |
3909 | 3909 | | |
| |||
3912 | 3912 | | |
3913 | 3913 | | |
3914 | 3914 | | |
3915 | | - | |
| 3915 | + | |
3916 | 3916 | | |
3917 | 3917 | | |
3918 | 3918 | | |
3919 | | - | |
| 3919 | + | |
3920 | 3920 | | |
3921 | 3921 | | |
3922 | 3922 | | |
3923 | 3923 | | |
3924 | 3924 | | |
3925 | 3925 | | |
3926 | 3926 | | |
3927 | | - | |
| 3927 | + | |
3928 | 3928 | | |
3929 | 3929 | | |
3930 | 3930 | | |
| |||
0 commit comments