make equality less strange

This commit is contained in:
Daniella / Tove 2024-11-18 09:34:16 +01:00
parent 78ec4e066f
commit 6a4566c223
Signed by: TudbuT
GPG key ID: B3CF345217F202D3

View file

@ -1083,11 +1083,11 @@ impl Object {
pub fn is_truthy(&self) -> bool { pub fn is_truthy(&self) -> bool {
match &self.native { match &self.native {
Value::Null => self.kind.lock_ro().id != 0, Value::Null => self.kind.lock_ro().id != 0,
Value::Int(x) => x > &0, Value::Int(x) => *x > 0,
Value::Long(x) => x > &0, Value::Long(x) => *x > 0,
Value::Mega(x) => x > &0, Value::Mega(x) => *x > 0,
Value::Float(_) => true, Value::Float(x) => x.is_finite(),
Value::Double(_) => true, Value::Double(x) => x.is_finite(),
Value::Func(_) => true, Value::Func(_) => true,
Value::Array(_) => true, Value::Array(_) => true,
Value::Str(x) => !x.is_empty(), Value::Str(x) => !x.is_empty(),