Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

First try at replacing partials lines #7

Merged
merged 3 commits into from
Jul 11, 2016

Conversation

killercup
Copy link
Member

Concerns #1

@killercup
Copy link
Member Author

Currently it screws up the first example…

-                mem::transmute::<*mut c_void, &mut Box<FnMut(&Button)>>(data)(&button)
+                &mut *(data as *mut Box<for<'r> std::ops::FnMut(&'r controls::Button)>)Button)>)&button)

But I have not yet investigated why that is.

This is the span from the clippy.json file:

{
    "file_name": "src/controls.rs",
    "byte_start": 7710,
    "byte_end": 7771,
    "line_start": 245,
    "line_end": 245,
    "column_start": 17,
    "column_end": 78,
    "is_primary": true,
    "text": [
        {
            "text": "                mem::transmute::<*mut c_void, &mut Box<FnMut(&Button)>>(data)(&button)",
            "highlight_start": 17,
            "highlight_end": 78
        }
    ],
    "label": null,
    "suggested_replacement": "&mut *(data as *mut Box<for<'r> std::ops::FnMut(&'r controls::Button)>)",
    "expansion": null
}

@killercup
Copy link
Member Author

Oh, actually, I'm stupid. This might be clippy's fault: Column 78 is just before (&button) (cutting off the ( is my fault, though!)

cc @mcarton

@mcarton
Copy link
Member

mcarton commented Jul 9, 2016

Yes, clippy forgets to add parenthesis: foo(bar)(baz) is transformed into &mut *(…)(baz) while it should be (&mut *(…))(baz). This will be fixed. https://github.com/Manishearth/rust-clippy/pull/1060 correctly handles parenthesis inside the suggestions, and I'm planning to correctly handle parenthesis around them (and also whether ; is needed) in another PR.

@killercup killercup merged commit 4eefb06 into master Jul 11, 2016
@oli-obk oli-obk deleted the feature/partial-line-replacements branch May 16, 2017 13:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants