mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 04:19:13 +00:00
Option begone part 2
This commit is contained in:
parent
96a774261f
commit
a2a3fecae3
31 changed files with 113 additions and 152 deletions
|
@ -45,7 +45,7 @@ pub(crate) fn expand_rules(
|
|||
transcriber::transcribe(&rule.rhs, &match_.bindings);
|
||||
ExpandResult { value, err: match_.err.or(transcribe_err) }
|
||||
} else {
|
||||
ExpandResult::with_err(
|
||||
ExpandResult::new(
|
||||
tt::Subtree { delimiter: tt::Delimiter::unspecified(), token_trees: vec![] },
|
||||
ExpandError::NoMatchingRule,
|
||||
)
|
||||
|
|
|
@ -324,12 +324,12 @@ pub struct ValueResult<T, E> {
|
|||
}
|
||||
|
||||
impl<T, E> ValueResult<T, E> {
|
||||
pub fn ok(value: T) -> Self {
|
||||
Self { value, err: None }
|
||||
pub fn new(value: T, err: E) -> Self {
|
||||
Self { value, err: Some(err) }
|
||||
}
|
||||
|
||||
pub fn with_err(value: T, err: E) -> Self {
|
||||
Self { value, err: Some(err) }
|
||||
pub fn ok(value: T) -> Self {
|
||||
Self { value, err: None }
|
||||
}
|
||||
|
||||
pub fn only_err(err: E) -> Self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue