Commit b2f88e9
committed
fix(eta_reduction): don't lint when method crate has duplicate name\n\nThe
redundant_closure_for_method_calls lint generates a textual path\nfor the suggested replacement via get_path_from_caller_to_method_type\n(e.g. ipnetwork::IpNetwork::ip). When a project has a \"diamond\ndependency\" — two direct or transitive dependencies that pull in\ndifferent versions of the same library — that path will resolve to\nwhatever version is in scope at the call site, which may not be the\nversion that the method actually belongs to. Applying the suggestion\nthen breaks the build.\n\nFix: in the MethodCall branch, add a guard using the new helper\nis_method_from_ambiguous_crate that checks whether more than one\nexternal crate is loaded under the same name as the method's defining\ncrate. If so, avoid linting because we cannot generate an unambiguous\npath.\n\nFixes #16788"1 parent c07baa4 commit b2f88e9
1 file changed
Lines changed: 32 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
269 | 276 | | |
270 | 277 | | |
271 | 278 | | |
| |||
385 | 392 | | |
386 | 393 | | |
387 | 394 | | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
0 commit comments