Skip to content

Commit

Permalink
refactor(buck2_transition): remove use of try_blocks [rustc-stable]
Browse files Browse the repository at this point in the history
Summary: Unnecessary. The only use case was actually a bit roundabout, from
what I can tell: it was used to unwrap() a SharedResult using `?`, only so it
could immediately be re-packaged as a SharedResult from the result of the 'try'
expression.

Just skip all that, and let the value be returned directly.

GitHub Issue: facebook#265

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Change-Id: Ittluzprupvzmuprmspuzqnzuxovoxuyn
  • Loading branch information
thoughtpolice committed Jul 1, 2023
1 parent c9685a8 commit c69f195
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 0 additions & 2 deletions app/buck2_transition/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* of this source tree.
*/

#![feature(try_blocks)]

pub(crate) mod coerced_attr;
pub(crate) mod transition;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,9 @@ impl TransitionCalculation for TransitionCalculationImpl {
ctx: &DiceComputations,
_cancellation: &CancellationContext,
) -> Self::Value {
let v: SharedResult<_> = try {
let v: SharedResult<_> =
do_apply_transition(ctx, self.attrs.as_deref(), &self.cfg, &self.transition_id)
.await?
};
.await;

Ok(Arc::new(v.with_context(|| {
format!("Error computing transition `{}`", self)
Expand Down

0 comments on commit c69f195

Please sign in to comment.