Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deny on panics with clippy #104

Merged
merged 1 commit into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/back/spv/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ impl Instruction {
}
}

#[allow(clippy::panic)]
pub(super) fn set_type(&mut self, id: Word) {
assert!(self.type_id.is_none(), "Type can only be set once");
self.type_id = Some(id);
self.wc += 1;
}

#[allow(clippy::panic)]
pub(super) fn set_result(&mut self, id: Word) {
assert!(self.result_id.is_none(), "Result can only be set once");
self.result_id = Some(id);
Expand Down
1 change: 1 addition & 0 deletions src/front/glsl/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::panic)]
use crate::{
Arena, ArraySize, BinaryOperator, Binding, BuiltIn, Constant, ConstantInner, EntryPoint,
Expression, FastHashMap, Function, GlobalVariable, Handle, Header, LocalVariable, Module,
Expand Down
1 change: 1 addition & 0 deletions src/front/glsl_new/parser.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![allow(unused_braces)]
#![allow(clippy::panic)]
use pomelo::pomelo;

pomelo! {
Expand Down
10 changes: 8 additions & 2 deletions src/front/spv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,10 @@ impl<I: Iterator<Item = u32>> Parser<I> {

fn make_expression_storage(&mut self) -> Arena<crate::Expression> {
let mut expressions = Arena::new();
assert!(self.lookup_expression.is_empty());
#[allow(clippy::panic)]
{
assert!(self.lookup_expression.is_empty());
}
// register global variables
for (&id, var) in self.lookup_variable.iter() {
self.lookup_expression.insert(
Expand Down Expand Up @@ -1161,7 +1164,10 @@ impl<I: Iterator<Item = u32>> Parser<I> {
let ty = module.types.get_mut(handle);
match ty.inner {
crate::TypeInner::Sampler { ref mut comparison } => {
assert!(!*comparison);
#[allow(clippy::panic)]
{
assert!(!*comparison)
};
*comparison = true;
}
crate::TypeInner::Image {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! To improve performance and reduce memory usage, most structures are stored
//! in an [`Arena`], and can be retrieved using the corresponding [`Handle`].
#![allow(clippy::new_without_default)]
#![deny(clippy::panic)]

mod arena;
pub mod back;
Expand Down