diff options
author | Vincent Ambo <mail@tazj.in> | 2023-01-05T13·02+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2023-01-06T12·23+0000 |
commit | aadf71a6ed18855a1fa8b4d5a76508300f463966 (patch) | |
tree | b034bd24e0779221cbb7fb3b7a2d5b444f121474 /tvix/eval/src/warnings.rs | |
parent | 61b8a9b2ba278f697735a2c3ff77fff091c8f464 (diff) |
feat(tvix/eval): warn on empty let-bindings r/5606
Change-Id: Ib6ef7ce514abbd3e372dfe9df7137aa36dbda9d4 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7770 Reviewed-by: raitobezarius <tvl@lahfa.xyz> Reviewed-by: flokli <flokli@flokli.de> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/warnings.rs')
-rw-r--r-- | tvix/eval/src/warnings.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tvix/eval/src/warnings.rs b/tvix/eval/src/warnings.rs index 9ebf182f975d..cfe5044a8cbe 100644 --- a/tvix/eval/src/warnings.rs +++ b/tvix/eval/src/warnings.rs @@ -16,6 +16,7 @@ pub enum WarningKind { UselessBoolOperation(&'static str), DeadCode, EmptyInherit, + EmptyLet, /// Tvix internal warning for features triggered by users that are /// not actually implemented yet, but do not cause runtime failures. @@ -66,7 +67,7 @@ impl EvalWarning { } WarningKind::UselessInherit => { - "inherited variable already exists with the same value".to_string() + format!("inherit does nothing (this variable already exists with the same value)") } WarningKind::UnusedBinding => { @@ -100,6 +101,10 @@ impl EvalWarning { format!("this `inherit` statement is empty") } + WarningKind::EmptyLet => { + format!("this `let`-expression contains no bindings") + } + WarningKind::NotImplemented(what) => { format!("feature not yet implemented in tvix: {}", what) } @@ -119,6 +124,7 @@ impl EvalWarning { WarningKind::UselessBoolOperation(_) => "W007", WarningKind::DeadCode => "W008", WarningKind::EmptyInherit => "W009", + WarningKind::EmptyLet => "W010", WarningKind::NotImplemented(_) => "W999", } |