Skip to content

Commit

Permalink
Auto merge of #7949 - craftytrickster:map-clone-to-cloned, r=nox
Browse files Browse the repository at this point in the history
Making map+clone more succinct with cloned

#7906

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7949)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Oct 10, 2015
2 parents 0f8493a + de2060e commit 04266f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions components/net/storage_task.rs
Expand Up @@ -106,9 +106,10 @@ impl StorageManager {
index: u32) {
let origin = self.origin_as_string(url);
let data = self.select_data(storage_type);
sender.send(data.get(&origin)
.and_then(|&(_, ref entry)| entry.keys().nth(index as usize))
.map(|key| key.clone())).unwrap();
let key = data.get(&origin)
.and_then(|&(_, ref entry)| entry.keys().nth(index as usize))
.cloned();
sender.send(key).unwrap();
}

fn keys(&self,
Expand Down
2 changes: 1 addition & 1 deletion components/util/prefs.rs
Expand Up @@ -176,7 +176,7 @@ pub fn reset_pref(name: &str) -> Arc<PrefValue> {

pub fn reset_all_prefs() {
let names = {
PREFS.lock().unwrap().keys().map(|x| x.clone()).collect::<Vec<String>>()
PREFS.lock().unwrap().keys().cloned().collect::<Vec<String>>()
};
for name in names.iter() {
reset_pref(name);
Expand Down
2 changes: 1 addition & 1 deletion tests/reftest.rs
Expand Up @@ -100,7 +100,7 @@ fn main() {

match run(test_opts,
all_tests,
servo_args.iter().map(|x| x.clone()).collect()) {
servo_args.iter().cloned().collect()) {
Ok(false) => process::exit(1), // tests failed
Err(_) => process::exit(2), // I/O-related failure
_ => (),
Expand Down

0 comments on commit 04266f2

Please sign in to comment.