@@ 111,7 111,7 @@ impl CContext {
/// Returns the Word bound to the given var name, or panics if not found.
/// All unknown vars should get caught by the validation step.
pub fn lookup_var(&self, name: &str) -> &VarBinding {
- assert!(self.symtable.len() > 0, "No scope for variable lookup!");
+ assert!(!self.symtable.is_empty(), "No scope for variable lookup!");
for scope in self.symtable.iter().rev() {
if let Some(w) = scope.get(name) {
return w;
@@ 170,7 170,6 @@ impl CContext {
// I'm not entirely sure how to make it right
// yet. Unit is not actually a value, so.
ast::Lit::Unit => {
- 0;
unimplemented!()
//b.constant_null(type_unit),
}
@@ 354,7 353,10 @@ impl CContext {
}
}
ast::Expr::Block(exprs) => {
- assert!(exprs.len() > 0, "Blocks with no expressions are verboten!");
+ assert!(
+ !exprs.is_empty(),
+ "Blocks with no expressions are verboten!"
+ );
self.push_scope();
let last_words: (spirv::Word, spirv::Word) = exprs
.iter()
@@ 554,7 556,7 @@ impl CContext {
ctx: &verify::VContext,
def: &verify::FunctionDef,
) -> Result<(), crate::Error> {
- assert!(def.decl.body.len() > 0, "Empty function body!");
+ assert!(!def.decl.body.is_empty(), "Empty function body!");
let function_returns: spirv::Word =
self.get_type(ctx.types.get(&def.decl.returns).unwrap());
// Here we can assume all types exist.