]> git.lizzy.rs Git - rust.git/commitdiff
Update crates/rust-analyzer/src/handlers.rs
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 27 Jun 2020 23:23:32 +0000 (01:23 +0200)
committerGitHub <noreply@github.com>
Sat, 27 Jun 2020 23:23:32 +0000 (01:23 +0200)
Co-authored-by: Veetaha <veetaha2@gmail.com>
crates/rust-analyzer/src/handlers.rs

index 4d0684b2a3fe845c194f55287df184fe2ed3313a..615aa2eb0a44abbae98372b16f9bb540cdef4635 100644 (file)
@@ -413,9 +413,7 @@ pub(crate) fn handle_runnables(
         Some(offset) => {
             let source_file = snap.analysis.parse(file_id)?;
             algo::find_node_at_offset::<ast::MacroCall>(source_file.syntax(), offset)
-                .and_then(|it| it.path())
-                .and_then(|it| it.segment())
-                .and_then(|it| it.name_ref())
+                .and_then(|it| it.path()?.segment()?.name_ref())
                 .map_or(false, |it| it.text() == "expect")
         }
         None => false,