Skip to content

Commit

Permalink
Fix clippy warnings from rustc 1.73
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Oct 9, 2023
1 parent ee7b2dd commit 0075be7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 22 deletions.
3 changes: 2 additions & 1 deletion src/hg_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1105,7 +1105,8 @@ fn bundle_manifest<const CHUNK_SIZE: usize>(
let git_node = node.to_git().unwrap();
let git_parents = [parent1, parent2]
.into_iter()
.filter_map(|p| (!p.is_null()).then(|| (p.to_git().unwrap().into())))
.filter(|p| !p.is_null())
.map(|p| (p.to_git().unwrap().into()))
.collect_vec();
for (path, (hg_file, hg_fileparents)) in
get_changes(git_node.into(), &git_parents, false).map(WithPath::unzip)
Expand Down
27 changes: 13 additions & 14 deletions src/hg_connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,17 +655,17 @@ pub fn find_common(
}
let sample = take_sample::<_, _, SAMPLE_SIZE>(&mut rng, &mut undetermined);

let (known, unknown): (Vec<_>, Vec<_>) = conn
.known(&sample)
.iter()
.zip(sample.into_iter())
.partition_map(|(&known, head)| {
if known {
Either::Left(head)
} else {
Either::Right(head)
}
});
let (known, unknown): (Vec<_>, Vec<_>) =
conn.known(&sample)
.iter()
.zip(sample)
.partition_map(|(&known, head)| {
if known {
Either::Left(head)
} else {
Either::Right(head)
}
});

if undetermined.is_empty() && unknown.is_empty() {
return known;
Expand Down Expand Up @@ -775,9 +775,8 @@ pub fn find_common(
}
}
dag.iter()
.filter_map(|(_, data)| {
(data.known == Some(true) && !data.has_known_children).then(|| data.hg_node.unwrap())
})
.filter(|(_, data)| data.known == Some(true) && !data.has_known_children)
.map(|(_, data)| data.hg_node.unwrap())
.collect_vec()
}

Expand Down
11 changes: 4 additions & 7 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1141,15 +1141,15 @@ fn do_unbundle(clonebundle: bool, mut url: OsString) -> Result<(), String> {
}
let mut url = hg_url(&url).unwrap();
if !["http", "https", "file"].contains(&url.scheme()) {
return Err(format!("{} urls are not supported.", url.scheme()));
Err(format!("{} urls are not supported.", url.scheme()))?;
}
if graft_config_enabled(None)?.unwrap_or(false) {
init_graft();
}
if clonebundle {
let mut conn = get_connection(&url).unwrap();
if conn.get_capability(b"clonebundles").is_none() {
return Err("Repository does not support clonebundles")?;
Err("Repository does not support clonebundles")?;
}
url = get_clonebundle_url(&mut *conn).ok_or("Repository didn't provide a clonebundle")?;
eprintln!("Getting clone bundle from {}", url);
Expand Down Expand Up @@ -3497,11 +3497,8 @@ fn remote_helper_push(
.lock()
.unwrap()
.branch_heads()
.filter_map(|(h, b)| {
branch_names
.contains(b)
.then(|| format!("^{}", h.to_git().unwrap()))
})
.filter(|(h, b)| branch_names.contains(b))

Check failure on line 3500 in src/main.rs

View workflow job for this annotation

GitHub Actions / clippy (ubuntu-latest, 1.71.0)

the trait bound `std::boxed::Box<bstr::BStr>: std::borrow::Borrow<&bstr::BStr>` is not satisfied

error[E0277]: the trait bound `std::boxed::Box<bstr::BStr>: std::borrow::Borrow<&bstr::BStr>` is not satisfied --> src/main.rs:3500:56 | 3500 | .filter(|(h, b)| branch_names.contains(b)) | -------- ^ the trait `std::borrow::Borrow<&bstr::BStr>` is not implemented for `std::boxed::Box<bstr::BStr>` | | | required by a bound introduced by this call | = help: the trait `std::borrow::Borrow<T>` is implemented for `std::boxed::Box<T, A>` note: required by a bound in `std::collections::HashSet::<T, S>::contains` --> /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/collections/hash/set.rs:670:5

Check failure on line 3500 in src/main.rs

View workflow job for this annotation

GitHub Actions / clippy (macos-latest, 1.71.0)

the trait bound `std::boxed::Box<bstr::BStr>: std::borrow::Borrow<&bstr::BStr>` is not satisfied

error[E0277]: the trait bound `std::boxed::Box<bstr::BStr>: std::borrow::Borrow<&bstr::BStr>` is not satisfied --> src/main.rs:3500:56 | 3500 | .filter(|(h, b)| branch_names.contains(b)) | -------- ^ the trait `std::borrow::Borrow<&bstr::BStr>` is not implemented for `std::boxed::Box<bstr::BStr>` | | | required by a bound introduced by this call | = help: the trait `std::borrow::Borrow<T>` is implemented for `std::boxed::Box<T, A>` note: required by a bound in `std::collections::HashSet::<T, S>::contains` --> /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/collections/hash/set.rs:670:5
.map(|(h, b)| format!("^{}", h.to_git().unwrap()))
.chain(push_commits.iter().map(ToString::to_string))
.chain(["--topo-order".to_string(), "--full-history".to_string()]),
)
Expand Down

0 comments on commit 0075be7

Please sign in to comment.