Skip to content

Commit

Permalink
Merge pull request #82 from rigetti/breaking-hide-nom-error-type-from…
Browse files Browse the repository at this point in the history
…-public-api

Breaking: Hide nom error type from public API
  • Loading branch information
notmgsk committed Jun 17, 2022
2 parents fb20f4b + 72fcc89 commit 7567f49
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/program/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ impl Program {
}

impl FromStr for Program {
type Err = nom::Err<String>;
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
let lexed = lex(s).map_err(nom::Err::Error)?;
let lexed = lex(s)?;
let (_, instructions) = parse_instructions(&lexed).map_err(|err| match err {
nom::Err::Incomplete(_) => nom::Err::Error("incomplete".to_owned()),
nom::Err::Error(error) => nom::Err::Error(format!("{:?}", error)),
nom::Err::Failure(failure) => nom::Err::Error(format!("{:?}", failure)),
nom::Err::Incomplete(_) => "incomplete".to_owned(),
nom::Err::Error(error) => format!("{:?}", error),
nom::Err::Failure(failure) => format!("{:?}", failure),
})?;
let mut program = Self::new();

Expand Down

0 comments on commit 7567f49

Please sign in to comment.