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.
This commit is contained in:
commit
b6ee96c3b5
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user