diff --git a/src/lib.rs b/src/lib.rs index f61657f..ad6a0b6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -616,7 +616,7 @@ pub(crate) fn eat_expr>( AtRule::Debug(a, b) => Ok(Some(Expr::Debug(a, b))), AtRule::Warn(a, b) => Ok(Some(Expr::Warn(a, b))), AtRule::Error(pos, err) => Err(SassError::new(err, pos)), - AtRule::Return(_) => todo!("@return in unexpected location!"), + AtRule::Return(_) => Err("This at-rule is not allowed here.".into()), AtRule::Content => { return Err("@content is only allowed within mixin declarations.".into()) } diff --git a/tests/error.rs b/tests/error.rs index 34c91e1..2c4a765 100644 --- a/tests/error.rs +++ b/tests/error.rs @@ -15,3 +15,7 @@ error!( toplevel_invalid_atrule_ident, "@`or $i from 1 through 3 {}", "Error: Expected identifier." ); +error!( + return_as_style, + "a {@return foo;}", "Error: This at-rule is not allowed here." +);