Skip to content

Commit b6ee96c

Browse files
committed
Auto merge of rust-lang#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.
2 parents 4bed01c + 4e4dda5 commit b6ee96c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ fn process_struct_name_reference(
161161
let path_segment = name_ref.syntax().parent().and_then(ast::PathSegment::cast)?;
162162
// A `PathSegment` always belongs to a `Path`, so there's at least one `Path` at this point.
163163
let full_path =
164-
path_segment.syntax().parent()?.ancestors().map_while(ast::Path::cast).last().unwrap();
164+
path_segment.syntax().parent()?.ancestors().map_while(ast::Path::cast).last()?;
165165

166-
if full_path.segment().unwrap().name_ref()? != *name_ref {
166+
if full_path.segment()?.name_ref()? != *name_ref {
167167
// `name_ref` isn't the last segment of the path, so `full_path` doesn't point to the
168168
// struct we want to edit.
169169
return None;

0 commit comments

Comments
 (0)