Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement `Hash` for `Origin` (fix #302) #321
Conversation
This comment has been minimized.
This comment has been minimized.
skade
commented
May 5, 2017
|
@cGuille Wait for one of the maintainers to provide review :). Most maintainers of the URL crate live in the US, so this might take until later. Ignore the nightly error in the linked travis test suite, rust nightly is currently broken, not this lib. |
This comment has been minimized.
This comment has been minimized.
|
@SimonSapin is french fwiw, hopefully he can take a look soon-ish. Can you test also that opaque origins get different hashes? (It's trivial, but worth having that in the test-suite too). |
This comment has been minimized.
This comment has been minimized.
|
Hello, There is actually no hurry at all. :-) I am OK with adding more tests ; I will just have to figure out how. |
This comment has been minimized.
This comment has been minimized.
|
@skade, unfortunately, most of the maintainers of the url crate are me :) I’m usually in UTC+1~2. @cGuille You can hash without a hashmap like so: use std::collections::hash_map::DefaultHasher;
use std::hash::Hash;
fn hash<T: Hash>(value: T) -> u64 {
let mut hasher = DefaultHasher::new();
value.hash(&mut hasher);
hasher.finish()
}To make the test more interesting, you could use different URLs that have the same origin. Please also test that hashing is consistent with Thanks! |
cGuille
force-pushed the
cGuille:impl-hash-trait-for-origin
branch
from
894bc2f
to
459904f
May 5, 2017
This comment has been minimized.
This comment has been minimized.
|
Thank you! I updated the PR to test hash values directly instead of using |
This comment has been minimized.
This comment has been minimized.
|
Test that things that compare equal with |
cGuille
force-pushed the
cGuille:impl-hash-trait-for-origin
branch
from
459904f
to
38104b5
May 5, 2017
This comment has been minimized.
This comment has been minimized.
|
What do you think about this? Are there enough URL samples? |
cGuille
force-pushed the
cGuille:impl-hash-trait-for-origin
branch
from
38104b5
to
dbe1980
May 5, 2017
This comment has been minimized.
This comment has been minimized.
|
|
cGuille
force-pushed the
cGuille:impl-hash-trait-for-origin
branch
from
e224f8c
to
7e9c87d
May 10, 2017
This comment has been minimized.
This comment has been minimized.
|
I solved the conflict with Tell me if there is anything left to do regarding this PR. |
dtolnay
reviewed
May 12, 2017
dtolnay left a comment
|
Looks good to me. All of the feedback so far has been addressed. |
This comment has been minimized.
This comment has been minimized.
|
|
cGuille
force-pushed the
cGuille:impl-hash-trait-for-origin
branch
from
7e9c87d
to
4260325
May 26, 2017
This comment has been minimized.
This comment has been minimized.
|
I rebased upon master to solve this second conflict. Can this be merged? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r+ bors-servo probably doesn't listen to me... |
This comment has been minimized.
This comment has been minimized.
|
@brson: |
This comment has been minimized.
This comment has been minimized.
|
Sorry for the delay @cGuille ! |
This comment has been minimized.
This comment has been minimized.
|
@bors-servo r=brson |
This comment has been minimized.
This comment has been minimized.
|
|
This comment has been minimized.
This comment has been minimized.
bors-servo
added a commit
that referenced
this pull request
Jun 3, 2017
This comment has been minimized.
This comment has been minimized.
|
|
cGuille commentedMay 5, 2017
•
edited by larsbergstrom
Hello,
I'm a Rust / Open Source beginner, so just explain if anything is wrong. :-)
I am giving a try at issue #302. I just derived the
Hashfor theOrigintype.I have zero experience with testing in Rust so I just tried to demonstrate that it works, but I do not know how to write a good test for this.
What should I do now?
This change is