diff options
| author | bors <bors@rust-lang.org> | 2023-08-09 14:52:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-09 14:52:09 +0000 |
| commit | b6ee96c3b54e9222623b9eee18851966f081dad9 (patch) | |
| tree | 6d3c173bed2b88f23258ce22450aada2e1f31cc0 | |
| parent | 4bed01c36e01caf8b287cb0f62b4edff8ad52f19 (diff) | |
| parent | 4e4dda5f59ca6c07a8fe111ff5c0e33caa12a907 (diff) | |
| download | rust-b6ee96c3b54e9222623b9eee18851966f081dad9.tar.gz rust-b6ee96c3b54e9222623b9eee18851966f081dad9.zip | |
Auto merge of #15423 - alibektas:deunwrap/convert_named_struct_to_tuple_struct, r=lnicola
internal : Deunwrap convert_named_struct_to_tuple_struct Replaces `unwrap`s with `?` for the mentioned assist.
| -rw-r--r-- | crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs b/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs index fe1cb6fce36..76f021ed912 100644 --- a/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs +++ b/crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs @@ -161,9 +161,9 @@ fn process_struct_name_reference( let path_segment = name_ref.syntax().parent().and_then(ast::PathSegment::cast)?; // A `PathSegment` always belongs to a `Path`, so there's at least one `Path` at this point. let full_path = - path_segment.syntax().parent()?.ancestors().map_while(ast::Path::cast).last().unwrap(); + path_segment.syntax().parent()?.ancestors().map_while(ast::Path::cast).last()?; - if full_path.segment().unwrap().name_ref()? != *name_ref { + if full_path.segment()?.name_ref()? != *name_ref { // `name_ref` isn't the last segment of the path, so `full_path` doesn't point to the // struct we want to edit. return None; |
