Review comments

This commit is contained in:
bjorn3
2021-11-01 18:17:57 +01:00
parent 55f8f8ce05
commit 93e9bb02e4
2 changed files with 10 additions and 18 deletions

View File

@@ -39,12 +39,12 @@ impl Operand {
self
}
pub fn doc(&self) -> Option<&str> {
pub fn doc(&self) -> &str {
if let Some(doc) = &self.doc {
return Some(doc);
return doc;
}
match &self.kind.fields {
OperandKindFields::TypeVar(tvar) => Some(&tvar.doc),
OperandKindFields::TypeVar(tvar) => &tvar.doc,
_ => self.kind.doc(),
}
}
@@ -139,12 +139,14 @@ impl OperandKind {
doc: Some(doc),
}
}
fn doc(&self) -> Option<&str> {
fn doc(&self) -> &str {
if let Some(doc) = &self.doc {
return Some(doc);
return doc;
}
match &self.fields {
OperandKindFields::TypeVar(type_var) => Some(&type_var.doc),
OperandKindFields::TypeVar(type_var) => &type_var.doc,
// The only method to create an OperandKind with `doc` set to None is using a TypeVar,
// so all other options are unreachable here.
OperandKindFields::ImmEnum(_)
| OperandKindFields::ImmValue
| OperandKindFields::EntityRef