Skip to content

Commit 207f2da

Browse files
diliopmeta-codesync[bot]
authored andcommitted
fix clippy lints & buck2 OSS CI errors
Summary: Fix existing 1.90.0 and new 1.91.1 clippy lints via: ``` buck2 run fbcode//common/rust/tools/rustfix2:rustfix -- --clippy --target fbcode//common/rust/... --target fbcode//buck2/allocative/... --target fbcode//buck2/app/... --target fbcode//buck2/buck2_tpx_cli/... --target fbcode//buck2/dice/... --target fbcode//buck2/dice_replay/... --target fbcode//buck2/facebook/... --target fbcode//buck2/gazebo/... --target fbcode//buck2/host_sharing/... --target fbcode//buck2/integrations/... --target fbcode//buck2/remote_execution/... --target fbcode//buck2/shed/... --target fbcode//buck2/starlark-rust/... --target fbcode//buck2/superconsole/... --target fbcode//remote_execution/... --target fbcode//target_determinator/... ``` plus OSS errors from `fbcode/buck2/scripts/ci.sh` Reviewed By: dtolnay Differential Revision: D87088632 fbshipit-source-id: 956943c547bb2ebe5aa8b031d741e9467233352e
1 parent 7d4f873 commit 207f2da

3 files changed

Lines changed: 26 additions & 29 deletions

File tree

shed/facet/proc_macros/factory_impl.rs

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -555,27 +555,24 @@ impl Facets {
555555
}
556556

557557
fn extract_facet_return_type(sig: &mut Signature) -> Result<(Type, Fallibility), Error> {
558-
if let ReturnType::Type(_, ty) = &mut sig.output {
559-
if let Type::Path(type_path) = &mut **ty {
560-
if let Some(segment) = type_path.path.segments.last_mut() {
561-
match &mut segment.arguments {
562-
PathArguments::None => {
563-
// The type path should be directly to the facet.
564-
let facet_ty = (**ty).clone();
565-
return Ok((facet_ty, Fallibility::Infallible));
566-
}
567-
PathArguments::AngleBracketed(arguments) => {
568-
if let Some(GenericArgument::Type(first_ty)) =
569-
arguments.args.first_mut()
570-
{
571-
// This type should be directly to the facet.
572-
let facet_ty = first_ty.clone();
573-
return Ok((facet_ty, Fallibility::Fallible));
574-
}
575-
}
576-
_ => {}
558+
if let ReturnType::Type(_, ty) = &mut sig.output
559+
&& let Type::Path(type_path) = &mut **ty
560+
&& let Some(segment) = type_path.path.segments.last_mut()
561+
{
562+
match &mut segment.arguments {
563+
PathArguments::None => {
564+
// The type path should be directly to the facet.
565+
let facet_ty = (**ty).clone();
566+
return Ok((facet_ty, Fallibility::Infallible));
567+
}
568+
PathArguments::AngleBracketed(arguments) => {
569+
if let Some(GenericArgument::Type(first_ty)) = arguments.args.first_mut() {
570+
// This type should be directly to the facet.
571+
let facet_ty = first_ty.clone();
572+
return Ok((facet_ty, Fallibility::Fallible));
577573
}
578574
}
575+
_ => {}
579576
}
580577
}
581578
Err(Error::new_spanned(
@@ -621,10 +618,10 @@ impl FactoryParam {
621618
}
622619

623620
fn extract_type_ident(ty: &Type) -> Result<Ident, Error> {
624-
if let Type::Path(type_path) = ty {
625-
if let Some(ident) = type_path.path.get_ident() {
626-
return Ok(ident.clone());
627-
}
621+
if let Type::Path(type_path) = ty
622+
&& let Some(ident) = type_path.path.get_ident()
623+
{
624+
return Ok(ident.clone());
628625
}
629626
Err(Error::new_spanned(
630627
ty,

shed/futures_ext/src/stream/yield_periodically.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ impl<S: Stream> Stream for YieldPeriodically<'_, S> {
9999
match this.current_budget.checked_sub(elapsed) {
100100
Some(new_budget) => *this.current_budget = new_budget,
101101
None => {
102-
if let Some(on_large_overshoot) = &this.on_large_overshoot {
103-
if (elapsed - current_budget) > *this.budget * BUDGET_OVERSHOOT_MULTIPLIER {
104-
(on_large_overshoot)(current_budget, elapsed);
105-
}
102+
if let Some(on_large_overshoot) = &this.on_large_overshoot
103+
&& (elapsed - current_budget) > *this.budget * BUDGET_OVERSHOOT_MULTIPLIER
104+
{
105+
(on_large_overshoot)(current_budget, elapsed);
106106
}
107107
*this.must_yield = true;
108108
*this.current_budget = *this.budget;

shed/slog_glog_fmt/src/collector_serializer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,11 @@ mod tests {
277277
#[test]
278278
fn test_ignoring() {
279279
let mut rng: StdRng = SeedableRng::from_seed([2; 32]);
280-
let normal = vec![
280+
let normal = [
281281
TestKv::new("test1", &mut rng),
282282
TestKv::new("test2", &mut rng),
283283
];
284-
let ignore = vec![
284+
let ignore = [
285285
TestKv::new("ignore1", &mut rng),
286286
TestKv::new("ignore2", &mut rng),
287287
];

0 commit comments

Comments
 (0)