Merge pull request #282 from marcusklaas/qself-fix
Fix qself rewrites without explicit casts
This commit is contained in:
commit
2a61a989d5
25
src/types.rs
25
src/types.rs
@ -42,19 +42,22 @@ pub fn rewrite_path(context: &RewriteContext,
|
||||
if let Some(ref qself) = qself {
|
||||
result.push('<');
|
||||
result.push_str(&pprust::ty_to_string(&qself.ty));
|
||||
result.push_str(" as ");
|
||||
|
||||
let extra_offset = extra_offset(&result, offset);
|
||||
// 3 = ">::".len()
|
||||
let budget = try_opt!(width.checked_sub(extra_offset)) - 3;
|
||||
if skip_count > 0 {
|
||||
result.push_str(" as ");
|
||||
|
||||
result = try_opt!(rewrite_path_segments(result,
|
||||
path.segments.iter().take(skip_count),
|
||||
span_lo,
|
||||
path.span.hi,
|
||||
context,
|
||||
budget,
|
||||
offset + extra_offset));
|
||||
let extra_offset = extra_offset(&result, offset);
|
||||
// 3 = ">::".len()
|
||||
let budget = try_opt!(width.checked_sub(extra_offset)) - 3;
|
||||
|
||||
result = try_opt!(rewrite_path_segments(result,
|
||||
path.segments.iter().take(skip_count),
|
||||
span_lo,
|
||||
path.span.hi,
|
||||
context,
|
||||
budget,
|
||||
offset + extra_offset));
|
||||
}
|
||||
|
||||
result.push_str(">::");
|
||||
span_lo = qself.ty.span.hi + BytePos(1);
|
||||
|
@ -15,6 +15,8 @@ fn main() {
|
||||
Quux::<ParamOne, // Comment 1
|
||||
ParamTwo, // Comment 2
|
||||
>::some_func();
|
||||
|
||||
< *mut JSObject >:: relocate(entry);
|
||||
}
|
||||
|
||||
fn op(foo: Bar, key : &[u8], upd : Fn(Option<&memcache::Item> , Baz ) -> Result) -> MapResult {}
|
||||
|
@ -13,6 +13,8 @@ fn main() {
|
||||
supports_clipboard);
|
||||
|
||||
Quux::<ParamOne /* Comment 1 */, ParamTwo /* Comment 2 */>::some_func();
|
||||
|
||||
<*mut JSObject>::relocate(entry);
|
||||
}
|
||||
|
||||
fn op(foo: Bar, key: &[u8], upd: Fn(Option<&memcache::Item>, Baz) -> Result) -> MapResult {
|
||||
|
Loading…
x
Reference in New Issue
Block a user