This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 918ae1b
committed
Auto merge of rust-lang#11647 - flip1995:needless-pass-by-ref-mut-pub-api, r=xFrednet
Honor `avoid-breaking-exported-api` in `needless_pass_by_ref_mut`
Until now, the lint only emitted a warning, when breaking public API. Now it doesn't lint at all when the config value is not set to `false`, bringing it in line with the other lints using this config value.
Also ensures that this config value is documented in the lint.
changelog: none
(I don't think a changelog is necessary, since this lint is in `nursery`)
---
Fixes rust-lang/rust-clippy#11374
cc `@GuillaumeGomez`
Marking as draft: Does this lint even break public API? If I change a function signature from `fn foo(x: &mut T)` to `fn foo(x: &T)`, I can still call it with `foo(&mut x)`. The only "breaking" thing is that the `clippy::unnecessary_mut_passed` lint will complain that `&mut` at the callsite is not necessary, possibly trickling down to the crate user having to remote a `mut` from a variable. [Playground](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=058165a7663902e84af1d23e35c10d66).
Are there examples where this actually breaks public API, that I'm missing?File tree
12 files changed
+86
-54
lines changed- book/src
- clippy_config/src
- clippy_lints/src
- tests
- ui-toml/needless_pass_by_ref_mut
- ui
12 files changed
+86
-54
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
| 351 | + | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
263 | 263 | | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
| 266 | + | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
141 | 145 | | |
142 | 146 | | |
143 | 147 | | |
| |||
262 | 266 | | |
263 | 267 | | |
264 | 268 | | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | 269 | | |
269 | 270 | | |
270 | 271 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
287 | | - | |
| 288 | + | |
288 | 289 | | |
289 | 290 | | |
290 | 291 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
| 235 | + | |
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
254 | | - | |
| 254 | + | |
255 | 255 | | |
256 | 256 | | |
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
272 | 277 | | |
273 | 278 | | |
274 | 279 | | |
| |||
365 | 370 | | |
366 | 371 | | |
367 | 372 | | |
| 373 | + | |
368 | 374 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
| 113 | + | |
| 114 | + | |
117 | 115 | | |
118 | 116 | | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
| 117 | + | |
123 | 118 | | |
124 | | - | |
| 119 | + | |
| 120 | + | |
125 | 121 | | |
126 | 122 | | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 123 | + | |
131 | 124 | | |
132 | | - | |
| 125 | + | |
| 126 | + | |
133 | 127 | | |
134 | 128 | | |
135 | | - | |
| 129 | + | |
136 | 130 | | |
137 | 131 | | |
138 | 132 | | |
139 | 133 | | |
140 | 134 | | |
141 | | - | |
| 135 | + | |
142 | 136 | | |
143 | 137 | | |
144 | 138 | | |
145 | 139 | | |
146 | 140 | | |
147 | | - | |
| 141 | + | |
148 | 142 | | |
149 | 143 | | |
150 | 144 | | |
151 | 145 | | |
152 | 146 | | |
153 | | - | |
| 147 | + | |
154 | 148 | | |
155 | 149 | | |
156 | 150 | | |
157 | 151 | | |
158 | 152 | | |
159 | | - | |
| 153 | + | |
160 | 154 | | |
161 | 155 | | |
162 | 156 | | |
163 | 157 | | |
164 | 158 | | |
165 | | - | |
| 159 | + | |
166 | 160 | | |
167 | 161 | | |
168 | 162 | | |
169 | 163 | | |
170 | 164 | | |
171 | | - | |
| 165 | + | |
172 | 166 | | |
173 | 167 | | |
174 | 168 | | |
175 | 169 | | |
176 | 170 | | |
177 | | - | |
| 171 | + | |
178 | 172 | | |
179 | 173 | | |
180 | 174 | | |
181 | 175 | | |
182 | 176 | | |
183 | | - | |
| 177 | + | |
184 | 178 | | |
185 | 179 | | |
186 | 180 | | |
187 | 181 | | |
188 | 182 | | |
189 | | - | |
| 183 | + | |
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
193 | 187 | | |
194 | 188 | | |
195 | | - | |
| 189 | + | |
196 | 190 | | |
197 | 191 | | |
198 | 192 | | |
199 | 193 | | |
200 | 194 | | |
201 | | - | |
| 195 | + | |
202 | 196 | | |
203 | 197 | | |
204 | 198 | | |
205 | 199 | | |
206 | 200 | | |
207 | | - | |
| 201 | + | |
208 | 202 | | |
209 | 203 | | |
210 | 204 | | |
211 | 205 | | |
212 | 206 | | |
213 | | - | |
| 207 | + | |
214 | 208 | | |
215 | 209 | | |
216 | 210 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
0 commit comments