difftreelog
fix ObjValue is_empty should not account hidden fields
in: master
2 files changed
crates/jrsonnet-evaluator/src/obj.rsdiffbeforeafterboth669 }669 }670670671 fn len(&self) -> usize {671 fn len(&self) -> usize {672 // Maybe it will be better to not compute sort key here?672 self.fields_visibility()673 self.fields_visibility()673 .into_iter()674 .into_iter()674 .filter(|(_, (visible, _))| *visible)675 .filter(|(_, (visible, _))| *visible)675 .count()676 .count()676 }677 }677678679 /// Returns false only if there is any visible entry.680 ///681 /// Note that object with hidden fields `{a:: 1}` will be reported as empty here.678 fn is_empty(&self) -> bool {682 fn is_empty(&self) -> bool {679 if !self.this_entries.is_empty() {680 return false;681 }682 self.sup.as_ref().map_or(true, ObjValue::is_empty)683 self.len() != 0683 }684 }684685685 /// Run callback for every field found in object686 /// Run callback for every field found in objectcrates/jrsonnet-stdlib/src/strings.rsdiffbeforeafterboth28}28}292930#[builtin]30#[builtin]31pub fn builtin_escape_string_bash(str: String) -> String {31pub fn builtin_escape_string_bash(str_: String) -> String {32 const QUOTE: char = '\'';32 const QUOTE: char = '\'';33 let mut out = str.replace(QUOTE, "'\"'\"'");33 let mut out = str_.replace(QUOTE, "'\"'\"'");34 out.insert(0, QUOTE);34 out.insert(0, QUOTE);35 out.push(QUOTE);35 out.push(QUOTE);36 out36 out