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.rsdiffbeforeafterboth--- a/crates/jrsonnet-stdlib/src/strings.rs
+++ b/crates/jrsonnet-stdlib/src/strings.rs
@@ -28,9 +28,9 @@
}
#[builtin]
-pub fn builtin_escape_string_bash(str: String) -> String {
+pub fn builtin_escape_string_bash(str_: String) -> String {
const QUOTE: char = '\'';
- let mut out = str.replace(QUOTE, "'\"'\"'");
+ let mut out = str_.replace(QUOTE, "'\"'\"'");
out.insert(0, QUOTE);
out.push(QUOTE);
out