Skip to content

Commit

Permalink
Clippy fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
adetaylor committed Oct 9, 2021
1 parent 4de57d4 commit 8c0682e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions engine/src/conversion/parse/parse_bindgen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,11 @@ impl<'a> ParseBindgen<'a> {
let old_id = &urn.ident;
let new_id = &urn.rename;
let new_tyname = QualifiedName::new(ns, new_id.clone());
if segs.remove(0) != "self" {
panic!("Path didn't start with self");
}
if segs.remove(0) != "super" {
panic!("Path didn't start with self::super");
}
assert!(segs.remove(0) == "self", "Path didn't start with self");
assert!(
segs.remove(0) == "super",
"Path didn't start with self::super"
);
// This is similar to the path encountered within 'tree'
// but without the self::super prefix which is unhelpful
// in our output mod, because we prefer relative paths
Expand Down
11 changes: 5 additions & 6 deletions engine/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,10 @@ impl IncludeCppEngine {
}

pub fn config_mut(&mut self) -> &mut IncludeCppConfig {
if !matches!(self.state, State::NotGenerated) {
panic!("Can't alter config after generation commenced");
}
assert!(
matches!(self.state, State::NotGenerated),
"Can't alter config after generation commenced"
);
&mut self.config
}

Expand Down Expand Up @@ -562,9 +563,7 @@ pub fn preprocess(
cmd.arg(listing_path.to_str().unwrap());
cmd.stderr(Stdio::inherit());
let result = cmd.output().expect("failed to execute clang++");
if !result.status.success() {
panic!("failed to preprocess");
}
assert!(result.status.success(), "failed to preprocess");
let mut file = File::create(preprocess_path)?;
file.write_all(&result.stdout)?;
Ok(())
Expand Down

0 comments on commit 8c0682e

Please sign in to comment.