Fix span issue with generic method calls
This commit is contained in:
parent
686ec52b50
commit
c93c771e71
@ -217,15 +217,17 @@ fn rewrite_method_call(method_name: ast::Ident,
|
||||
width: usize,
|
||||
offset: Indent)
|
||||
-> Option<String> {
|
||||
let type_str = if types.is_empty() {
|
||||
String::new()
|
||||
let (lo, type_str) = if types.is_empty() {
|
||||
(args[0].span.hi, String::new())
|
||||
} else {
|
||||
let type_list = types.iter().map(|ty| pprust::ty_to_string(ty)).collect::<Vec<_>>();
|
||||
format!("::<{}>", type_list.join(", "))
|
||||
|
||||
(types.last().unwrap().span.hi,
|
||||
format!("::<{}>", type_list.join(", ")))
|
||||
};
|
||||
|
||||
let callee_str = format!(".{}{}", method_name, type_str);
|
||||
let span = mk_sp(args[0].span.hi, span.hi);
|
||||
let span = mk_sp(lo, span.hi);
|
||||
|
||||
rewrite_call(context, &callee_str, &args[1..], span, width, offset)
|
||||
}
|
||||
|
@ -106,3 +106,9 @@ fn is_replaced_content() -> bool {
|
||||
constellat.send(ConstellationMsg::ViewportConstrained(
|
||||
self.id, constraints)).unwrap();
|
||||
}
|
||||
|
||||
fn issue587() {
|
||||
a.b::<()>(c);
|
||||
|
||||
std::mem::transmute(dl.symbol::<()>("init").unwrap())
|
||||
}
|
||||
|
@ -132,3 +132,9 @@ fn is_replaced_content() -> bool {
|
||||
constellat.send(ConstellationMsg::ViewportConstrained(self.id, constraints))
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn issue587() {
|
||||
a.b::<()>(c);
|
||||
|
||||
std::mem::transmute(dl.symbol::<()>("init").unwrap())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user