rust-analyzer/crates/syntax/src
bors da6f7e2c7b Auto merge of #16275 - davidsemakula:ast-path-segments, r=Veykril
fix: Fix `ast::Path::segments` implementation

calling `ast::Path::segments` on a qualifier currently returns all the segments of the top path instead of just the segments of the qualifier.

The issue can be summarized by the simple failing test below:
```rust
#[test]
fn path_segments() {
    //use ra_ap_syntax::ast;
    let path: ast::Path = ...; // e.g. `ast::Path` for "foo::bar::item".

    let path_segments: Vec<_> = path.segments().collect();
    let qualifier_segments: Vec<_> = path.qualifier().unwrap().segments().collect();
    assert_eq!(path_segments.len(), qualifier_segments.len() + 1); // Fails because `LHS = RHS`.
}
```

This PR:
- Fixes the implementation of `ast::Path::segments`
- Fixes `ast::Path::segments` callers that either implicitly relied on behavior of previous implementation or exhibited other "wrong" behavior directly related to the result of `ast::Path::segments` (all callers have been reviewed, only one required modification)
- Removes unnecessary (and now unused) `ast::Path::segments` alternatives
2024-01-09 15:41:48 +00:00
..
ast Auto merge of #16275 - davidsemakula:ast-path-segments, r=Veykril 2024-01-09 15:41:48 +00:00
parsing Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
tests Merge commit '3b7c7f97e4' into sync-from-ra 2023-11-08 08:15:03 +02:00
validation Add semicolons for consistency 2021-10-03 23:39:43 +11:00
algo.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
ast.rs Add inlay hint for exclusive ranges 2024-01-07 09:33:56 +00:00
fuzz.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
hacks.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
lib.rs Split out rustc_lexer from rustc_dependencies 2024-01-08 15:24:46 +01:00
parsing.rs dead code 2021-12-28 19:13:30 +03:00
ptr.rs fix: Smaller spans for unresolved field and method diagnostics 2023-12-08 18:46:36 +01:00
syntax_error.rs Run cargo fix --edition-idioms 2022-07-20 15:02:08 +02:00
syntax_node.rs ⬆️ rust-analyzer 2023-02-13 13:55:14 +02:00
ted.rs ⬆️ rust-analyzer 2023-01-09 10:36:22 -08:00
tests.rs Replace ID based TokenMap with proper relative text-ranges / spans 2023-11-28 10:55:39 +01:00
token_text.rs Implicit format args support 2023-12-05 17:07:00 +01:00
utils.rs Simplify and improve perf of import_assets::import_for_item 2023-12-12 11:35:34 +01:00
validation.rs Split out rustc_lexer from rustc_dependencies 2024-01-08 15:24:46 +01:00