Commit 3f977ba
committed
Auto merge of #43728 - zackmdavis:fnused, r=eddyb
#[must_use] for functions
This implements [RFC 1940](rust-lang/rfcs#1940).
The RFC and discussion thereof seem to suggest that tagging `PartialEq::eq` and friends as `#[must_use]` would automatically lint for unused comparisons, but it doesn't work out that way (at least the way I've implemented it): unused `.eq` method calls get linted, but not `==` expressions. (The lint operates on the HIR, which sees binary operations as their own thing, even if they ultimately just call `.eq` _&c._.)
What do _you_ think??
Resolves #43302.File tree
4 files changed
+79
-9
lines changed- src
- libcore
- librustc_lint
- test/ui/lint
4 files changed
+79
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| |||
625 | 627 | | |
626 | 628 | | |
627 | 629 | | |
| 630 | + | |
628 | 631 | | |
629 | 632 | | |
630 | 633 | | |
| |||
640 | 643 | | |
641 | 644 | | |
642 | 645 | | |
| 646 | + | |
643 | 647 | | |
644 | 648 | | |
645 | 649 | | |
| |||
661 | 665 | | |
662 | 666 | | |
663 | 667 | | |
| 668 | + | |
664 | 669 | | |
665 | 670 | | |
666 | 671 | | |
| |||
681 | 686 | | |
682 | 687 | | |
683 | 688 | | |
| 689 | + | |
684 | 690 | | |
685 | 691 | | |
686 | 692 | | |
| |||
702 | 708 | | |
703 | 709 | | |
704 | 710 | | |
| 711 | + | |
705 | 712 | | |
706 | 713 | | |
707 | 714 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 148 | + | |
| 149 | + | |
153 | 150 | | |
154 | 151 | | |
155 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
156 | 172 | | |
157 | 173 | | |
158 | 174 | | |
159 | | - | |
| 175 | + | |
160 | 176 | | |
161 | 177 | | |
162 | | - | |
163 | | - | |
| 178 | + | |
| 179 | + | |
164 | 180 | | |
165 | 181 | | |
166 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments