Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up some issues flagged by clippy #294

Merged
merged 7 commits into from May 20, 2017
Merged

Conversation

@daniellockyer
Copy link
Contributor

daniellockyer commented Apr 19, 2017

This change is Reviewable

let tmp = pieces[piece_pointer];
pieces[piece_pointer] = pieces[compress_pointer + swaps - 1];
pieces[compress_pointer + swaps - 1] = tmp;
pieces.swap(piece_pointer, compress_pointer + swaps - 1);

This comment has been minimized.

@lucab

lucab May 9, 2017

Possibly out of scope of this PR, but I think both parameters would benefit from some bound checking to ensure no index underflow/overflow will induce a panic here at runtime.

This comment has been minimized.

@Hoverbear

Hoverbear May 10, 2017

Member

Could you make a separate issue for this? Thanks!

This comment has been minimized.

This comment has been minimized.

@luisbg

luisbg May 16, 2017

Unfortunately this still appears as part of the clippy related changes.

Can you move this into a new branch?

This comment has been minimized.

@dtolnay

dtolnay May 16, 2017

This is a clippy related change. Bounds checking is a separate issue being tracked in #334.

This comment has been minimized.

@luisbg

luisbg May 16, 2017

Cool! Then this PR looks OK to merge to me 👍

@vks
Copy link

vks commented May 9, 2017

What is the minimum Rust version that should be supported by rust-url?

@@ -26,7 +26,7 @@ fn check_invariants(url: &Url) {
}


fn run_parsing(input: String, base: String, expected: Result<ExpectedAttributes, ()>) {
fn run_parsing(input: &String, base: &String, expected: Result<ExpectedAttributes, ()>) {

This comment has been minimized.

@vks

vks May 9, 2017

Why not use &str instead of &String?

@@ -1031,7 +1031,7 @@ impl<'a> Parser<'a> {
}
}
None => return Ok((None, None)),
_ => panic!("Programming error. parse_query_and_fragment() called without ? or # {:?}")

This comment has been minimized.

@Hoverbear

Hoverbear May 10, 2017

Member

This is strange. Why was the {:?} there?

This comment has been minimized.

@luisbg

luisbg May 16, 2017

I thought this would give a compiler error. Weird.

This comment has been minimized.

@Hoverbear

Hoverbear May 17, 2017

Member

Indeed. Me too.

This comment has been minimized.

@SimonSapin

SimonSapin May 20, 2017

Member

This compiles because the panic! macro has a special case for use with a single "argument" that by-passes the string formatting system entirely:

https://github.com/rust-lang/rust/blob/a0da1e0653/src/libstd/macros.rs#L43-L49

Copy link
Member

Hoverbear left a comment

LGTM overall. I think @vks's comment about &str should be considered though.

Copy link

dtolnay left a comment

Ditto @vks, those &String should be &str instead. LGTM otherwise.

@daniellockyer
Copy link
Contributor Author

daniellockyer commented May 12, 2017

@vks + @Hoverbear + @dtolnay: I've switched it from &String to &str. Good to go?

@vks
Copy link

vks commented May 12, 2017

Great, looks good to me!

@lucab
lucab approved these changes May 12, 2017
@luisbg
Copy link

luisbg commented May 16, 2017

Looks good 😄 These changes make the code nicer.

Except that one change in src/host.rs that is more than pure style cleanup. Not sure if maintainers want that in a new branch or if it is OK as is.

Thanks Daniel

@Hoverbear
Copy link
Member

Hoverbear commented May 17, 2017

We have multiple good reviews so lets merge!

@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2017

The latest upstream changes (presumably #342) made this pull request unmergeable. Please resolve the merge conflicts.

@SimonSapin
Copy link
Member

SimonSapin commented May 20, 2017

@vks I’m not really keeping track of a minimum version. We’ll figure it out when/if someone complains :)

This looks very nice. Thank you all!

@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented May 20, 2017

📌 Commit 78b4f57 has been approved by SimonSapin

@bors-servo
Copy link
Contributor

bors-servo commented May 20, 2017

Testing commit 78b4f57 with merge e461e34...

bors-servo added a commit that referenced this pull request May 20, 2017
Fix up some issues flagged by clippy

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/294)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 20, 2017

☀️ Test successful - status-travis
Approved by: SimonSapin
Pushing e461e34 to master...

@bors-servo bors-servo merged commit 78b4f57 into servo:master May 20, 2017
3 of 4 checks passed
3 of 4 checks passed
code-review/reviewable 7 files, 1 discussion left (dtolnay, Hoverbear, lucab, luisbg)
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@daniellockyer daniellockyer deleted the daniellockyer:clippy-fixes branch May 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.