We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b64e5b3 commit 4e4dda5Copy full SHA for 4e4dda5
crates/ide-assists/src/handlers/convert_named_struct_to_tuple_struct.rs
@@ -161,9 +161,9 @@ fn process_struct_name_reference(
161
let path_segment = name_ref.syntax().parent().and_then(ast::PathSegment::cast)?;
162
// A `PathSegment` always belongs to a `Path`, so there's at least one `Path` at this point.
163
let full_path =
164
- path_segment.syntax().parent()?.ancestors().map_while(ast::Path::cast).last().unwrap();
+ path_segment.syntax().parent()?.ancestors().map_while(ast::Path::cast).last()?;
165
166
- if full_path.segment().unwrap().name_ref()? != *name_ref {
+ if full_path.segment()?.name_ref()? != *name_ref {
167
// `name_ref` isn't the last segment of the path, so `full_path` doesn't point to the
168
// struct we want to edit.
169
return None;
0 commit comments