Skip to content

Commit c09257b

Browse files
sasezakiazjezz
andauthored
refactor(formatter): use if let to fix unnecessary_unwrap warning (#781)
Co-authored-by: Seifeddine Gmati <[email protected]>
1 parent 2566e57 commit c09257b

File tree

1 file changed

+3
-1
lines changed
  • crates/formatter/src/internal/printer

1 file changed

+3
-1
lines changed

crates/formatter/src/internal/printer/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,9 @@ impl<'arena> Printer<'arena> {
495495
Document::Group(group) => {
496496
let group_mode = if *group.should_break.borrow() { Mode::Break } else { mode };
497497
if group.expanded_states.is_some() && group_mode.is_break() {
498-
if let Some(last_state) = group.expanded_states.as_ref().unwrap().last() {
498+
if let Some(expanded_states) = group.expanded_states.as_ref()
499+
&& let Some(last_state) = expanded_states.last()
500+
{
499501
stack.push((group_mode, last_state));
500502
}
501503
} else {

0 commit comments

Comments
 (0)