Skip to content

Remove helper traits - #7401

Merged
bors-servo merged 5 commits into
servo:masterfrom
nox:rm-helpers
Aug 27, 2015
Merged

bors-servo merged 5 commits into
servo:masterfrom
nox:rm-helpers

Conversation

@nox

@nox nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor

Now that JSRef<T> is gone, there is no need to have helper traits.

Review on Reviewable

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Aug 27, 2015
@highfive

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@frewsxcv

Copy link
Copy Markdown
Contributor

@nox FYI, in case you missed it, this fails tidy

Comment thread components/script/dom/attr.rs Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for using 'a anywhere in this line (fn foo(&self)->Ref<Bar> will work) because elision.

ditto everywhere else in this PR

@Manishearth

Copy link
Copy Markdown
Member

LGTM, though I'd prefer if elidable things were elided (clears up the code, and makes it easier to sed). I think all lifetime params introduced in this PR can be elided.

I may do a more thorough Reviewable review once I have a better viewport, but it otherwise looks good.

@Ms2ger

Ms2ger commented Aug 27, 2015

Copy link
Copy Markdown
Contributor

I much prefer not eliding lifetimes.

@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

I prefer eliding too, gratuitous tokens that can be inferred don't please me. Will try to sed my way.

@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

Now with elision, scripts in commit messages, and new commits to remove AttributeHandlers.

@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

And finally, tidy not failing.

@nox nox added the S-needs-squash Some (or all) of the commits in the PR should be combined. label Aug 27, 2015
@Manishearth

Copy link
Copy Markdown
Member

r+, squash anything if you want to

@nox nox removed the S-needs-squash Some (or all) of the commits in the PR should be combined. label Aug 27, 2015
@Manishearth

Copy link
Copy Markdown
Member

@bors-servo r+

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit c4f7b60 has been approved by Manishearth

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 27, 2015
@Manishearth

Copy link
Copy Markdown
Member

@Ms2ger elision happens in obvious cases (e.g. fn foo<'a>(&'a T) -> &'a U and fn bar(&'a T, &'b U, &'c V)), where &'a T could also be a T<'a>, etc. In these cases it's mostly noise -- if you're returning a reference from a reference it's obvious that the lifetimes must be the same. It also makes the code harder to grep or sed, and is overall jarring to the eyes.

I really think we should only be eliding when we have to, because it's those cases where the lifetimes are doing something nontrivial and often need to be looked at. Having lifetime params everywhere just makes these cases less prominent.

As part of the clippy cleanup I will be moving the rest of Servo to elision (clippy detects areas where the lifetimes are unnecessary), so if we don't want to do that we should discuss it now.

@Ms2ger Ms2ger closed this Aug 27, 2015
@Ms2ger Ms2ger reopened this Aug 27, 2015
@Ms2ger

Ms2ger commented Aug 27, 2015

Copy link
Copy Markdown
Contributor

@bors-servo r-

@Ms2ger

Ms2ger commented Aug 27, 2015

Copy link
Copy Markdown
Contributor

@bors-servo r=Manishearth

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit c4f7b60 has been approved by Manishearth

@larsbergstrom

Copy link
Copy Markdown
Contributor

@bors-servo retry

@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo r-

@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo p=1 r+

nox added 3 commits August 27, 2015 16:59
Method get_or_create() is now directly on servohtmlparser::Sink.
On components/script/*.rs:

    # Remove imports.
    /^ *use dom::element::\{.*AttributeHandlers/ {
        s/\{AttributeHandlers, /\{/
        s/, AttributeHandlers//g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::element::\{?AttributeHandlers\}?;$/d

    # Remove AttributeHandlers.
    /^pub trait AttributeHandlers \{$/,/^\}$/D

    # Patch AttributeHandlers methods.
    /^impl<'a> AttributeHandlers for &'a Element \{/,/^\}$/ {
        s/^impl<'a> AttributeHandlers for &'a Element \{/impl Element {/
        /^ *fn /s/\(self([,)])/\(\&self\1/
	/^ *fn.*\(&self/s/fn/pub fn/
    }

The few error cases were then fixed by hand.
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 27, 2015
@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

@bors-servo r=Manishearth

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 2a028f6 has been approved by Manishearth

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 27, 2015
@nox

nox commented Aug 27, 2015

Copy link
Copy Markdown
Contributor Author

Rebased against last master to see if it makes it happy.

@Manishearth

Copy link
Copy Markdown
Member

@bors-servo r=Manishearth

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 2a028f6 has been approved by Manishearth

bors-servo pushed a commit that referenced this pull request Aug 27, 2015
Remove helper traits

Now that `JSRef<T>` is gone, there is no need to have helper traits.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7401)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 2a028f6 with merge 9094297...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, gonk, linux1, linux2, mac1, mac2, mac3

@Manishearth

Copy link
Copy Markdown
Member

\o/

(also yay, you broke all the PRs)

@nox
nox deleted the rm-helpers branch August 27, 2015 19:08
frewsxcv added a commit to frewsxcv/servo that referenced this pull request Aug 28, 2015
Prior to servo#7416 and servo#7401, many of these `impl` sections were not
identical
bors-servo pushed a commit that referenced this pull request Aug 28, 2015
Merge adjacent identical `impl` sections

Prior to #7416 and #7401, many of these `impl` sections were not
identical

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7431)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Aug 28, 2015
Merge adjacent identical `impl` sections

Prior to #7416 and #7401, many of these `impl` sections were not
identical

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7431)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants