Commit b7caf75
committed
Improve path segment joining.
There are many places that join path segments with `::` to produce a
string. A lot of these use `join("::")`. Many in rustdoc use
`join_with_double_colon`, and a few use `.joined("..")`. One in Clippy
uses `itertools::join`. A couple of them look for `kw::PathRoot` in the
first segment, which can be important.
This commit introduces `rustc_ast::join_path_{syms,ident}` to do the
joining for everyone. `rustc_ast` is as good a location for these as
any, being the earliest-running of the several crates with a `Path`
type. Two functions are needed because `Ident` printing is more complex
than simple `Symbol` printing.
The commit also removes `join_with_double_colon`, and
`estimate_item_path_byte_length` with it.
There are still a handful of places that join strings with "::" that are
unchanged. They are not that important: some of them are in tests, and
some of them first split a path around "::" and then rejoin with "::".
This fixes one test case where `{{root}}` shows up in an error message.1 parent f4b827a commit b7caf75
File tree
2 files changed
+11
-9
lines changed- clippy_lints/src/methods
- clippy_utils/src
2 files changed
+11
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
3245 | 3246 | | |
3246 | 3247 | | |
3247 | 3248 | | |
3248 | | - | |
3249 | | - | |
| 3249 | + | |
| 3250 | + | |
3250 | 3251 | | |
3251 | 3252 | | |
3252 | 3253 | | |
| |||
3256 | 3257 | | |
3257 | 3258 | | |
3258 | 3259 | | |
3259 | | - | |
| 3260 | + | |
3260 | 3261 | | |
3261 | 3262 | | |
3262 | 3263 | | |
| |||
3268 | 3269 | | |
3269 | 3270 | | |
3270 | 3271 | | |
3271 | | - | |
3272 | | - | |
| 3272 | + | |
| 3273 | + | |
3273 | 3274 | | |
3274 | | - | |
| 3275 | + | |
3275 | 3276 | | |
3276 | 3277 | | |
3277 | 3278 | | |
3278 | 3279 | | |
3279 | | - | |
| 3280 | + | |
3280 | 3281 | | |
3281 | | - | |
| 3282 | + | |
3282 | 3283 | | |
3283 | 3284 | | |
3284 | 3285 | | |
| |||
0 commit comments