Minor refactoring

This commit is contained in:
Ryo Yoshida 2023-01-30 19:44:51 +09:00
parent b75803ad31
commit 0df70d37fc
No known key found for this signature in database
GPG key ID: E25698A930586171
3 changed files with 15 additions and 18 deletions

View file

@ -1319,10 +1319,7 @@ impl<'db> SemanticsImpl<'db> {
let _p = profile::span("Semantics::analyze_impl");
let node = self.find_file(node);
let container = match self.with_ctx(|ctx| ctx.find_container(node)) {
Some(it) => it,
None => return None,
};
let container = self.with_ctx(|ctx| ctx.find_container(node))?;
let resolver = match container {
ChildContainer::DefWithBodyId(def) => {
@ -1582,7 +1579,7 @@ fn find_root(node: &SyntaxNode) -> SyntaxNode {
node.ancestors().last().unwrap()
}
/// `SemanticScope` encapsulates the notion of a scope (the set of visible
/// `SemanticsScope` encapsulates the notion of a scope (the set of visible
/// names) at a particular program point.
///
/// It is a bit tricky, as scopes do not really exist inside the compiler.