Skip to content

Commit

Permalink
feat: fixup broken call on stable
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylendog committed Sep 4, 2022
1 parent 92be8aa commit c6597b4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 1 addition & 2 deletions compiler/fluxc_parser/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! Defines the parser for Flux code.
#![feature(option_result_contains)]

use std::rc::Rc;

use fluxc_ast::{Ident, Node, Stmt, AST};
Expand All @@ -12,6 +10,7 @@ mod expr;
mod span;
mod stmt;
mod ty;
mod util;

/// Internal moduel to prevent leakage of the `Rule` type to external
/// crates.
Expand Down
2 changes: 1 addition & 1 deletion compiler/fluxc_parser/src/stmt/func_decl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use fluxc_span::Span;
use fluxc_types::Type;
use pest::iterators::Pair;

use crate::{unexpected_rule, Context, PResult, Parse, Rule};
use crate::{unexpected_rule, Context, PResult, Parse, Rule, util::Contains};

impl Parse for FuncCall {
#[tracing::instrument]
Expand Down
13 changes: 13 additions & 0 deletions compiler/fluxc_parser/src/util.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pub trait Contains<P: PartialEq> {
/// Test if the target contains `other`.
fn contains(&self, other: &P) -> bool;
}

impl <P: PartialEq> Contains<P> for Option<P> {
fn contains(&self, other: &P) -> bool {
match self.as_ref() {
Some(s) => s.eq(other),
None => false,
}
}
}

0 comments on commit c6597b4

Please sign in to comment.