Fix suggestions given mulitple bad lifetimes
When given multiple lifetimes prior to type parameters in generic parameters, do not ICE and print the correct suggestion.
This commit is contained in:
parent
e2f221c759
commit
e3ba6ed3f5
5 changed files with 69 additions and 21 deletions
|
@ -135,10 +135,11 @@ impl CodeSuggestion {
|
|||
if let Some(line) = line_opt {
|
||||
if let Some(lo) = line.char_indices().map(|(i, _)| i).nth(lo) {
|
||||
let hi_opt = hi_opt.and_then(|hi| line.char_indices().map(|(i, _)| i).nth(hi));
|
||||
buf.push_str(match hi_opt {
|
||||
Some(hi) => &line[lo..hi],
|
||||
None => &line[lo..],
|
||||
});
|
||||
match hi_opt {
|
||||
Some(hi) if hi > lo => buf.push_str(&line[lo..hi]),
|
||||
Some(_) => (),
|
||||
None => buf.push_str(&line[lo..]),
|
||||
}
|
||||
}
|
||||
if let None = hi_opt {
|
||||
buf.push('\n');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue