Commit aa64f56
authored
Rollup merge of rust-lang#147768 - chenyukang:yukang-refactor-report-method-error, r=nnethercote
Code refactoring on hir report_no_match_method_error
While working on rust-lang#147753, I found `report_no_match_method_error` now is too long for maintain, 1200 lines of code now:
https://github.com/rust-lang/rust/blob/57ef8d642d21965304bde849bab4f389b4353e27/compiler/rustc_hir_typeck/src/method/suggest.rs#L589-L1736
this PR try to refactor it.
I tried my best to group most related code into same places, but the logic here is still very complex, there are some variables across different functions, maybe we need more work to make it better understand.
Maybe we could add a tidy check to avoid long spaghetti code.
r? `@nnethercote`File tree
4 files changed
+1020
-921
lines changed- compiler/rustc_hir_typeck/src
- fn_ctxt
- method
4 files changed
+1020
-921
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1953 | 1953 | | |
1954 | 1954 | | |
1955 | 1955 | | |
1956 | | - | |
| 1956 | + | |
1957 | 1957 | | |
1958 | 1958 | | |
1959 | 1959 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 168 | + | |
173 | 169 | | |
174 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
175 | 174 | | |
176 | 175 | | |
177 | 176 | | |
| |||
1212 | 1211 | | |
1213 | 1212 | | |
1214 | 1213 | | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
| 1214 | + | |
1220 | 1215 | | |
1221 | 1216 | | |
1222 | 1217 | | |
| |||
1889 | 1884 | | |
1890 | 1885 | | |
1891 | 1886 | | |
1892 | | - | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
| 1887 | + | |
1897 | 1888 | | |
1898 | 1889 | | |
1899 | 1890 | | |
| |||
0 commit comments