git.delta.rocks / jrsonnet / refs/commits / 00b4f053911b

difftreelog

Merge branch 'master' of github.com:CertainLach/jrsonnet into type-safety

Yaroslav Bolyukin2021-01-24parents: #3fc6c25 #847c11f.patch.diff
in: master

3 files changed

modifiedcmds/jrsonnet/src/main.rsdiffbeforeafterboth
--- a/cmds/jrsonnet/src/main.rs
+++ b/cmds/jrsonnet/src/main.rs
@@ -136,7 +136,10 @@
 		let mut file = File::create(path)?;
 		writeln!(file, "{}", state.manifest(val)?)?;
 	} else {
-		println!("{}", state.manifest(val)?);
+		let output = state.manifest(val)?;
+		if !output.is_empty() {
+			println!("{}", output);
+		}
 	}
 
 	Ok(())
modifiedcrates/jrsonnet-evaluator/src/builtin/manifest.rsdiffbeforeafterboth
--- a/crates/jrsonnet-evaluator/src/builtin/manifest.rs
+++ b/crates/jrsonnet-evaluator/src/builtin/manifest.rs
@@ -74,7 +74,7 @@
 			} else if mtype == ManifestType::Std {
 				buf.push_str("\n\n");
 				buf.push_str(cur_padding);
-			} else if mtype == ManifestType::ToString {
+			} else if mtype == ManifestType::ToString || mtype == ManifestType::Manifest {
 				buf.push(' ');
 			}
 			buf.push(']');
@@ -112,7 +112,7 @@
 			} else if mtype == ManifestType::Std {
 				buf.push_str("\n\n");
 				buf.push_str(cur_padding);
-			} else if mtype == ManifestType::ToString {
+			} else if mtype == ManifestType::ToString || mtype == ManifestType::Manifest {
 				buf.push(' ');
 			}
 			buf.push('}');
modifiedcrates/jrsonnet-evaluator/src/builtin/mod.rsdiffbeforeafterboth
378 0, from: ty!(number) => Val::Num;378 0, from: ty!(number) => Val::Num;
379 1, to: ty!(number) => Val::Num;379 1, to: ty!(number) => Val::Num;
380 ], {380 ], {
381 if to < from {
382 return Ok(Val::Arr(Rc::new(Vec::new())))
383 }
381 let mut out = Vec::with_capacity((1+to as usize-from as usize).max(0));384 let mut out = Vec::with_capacity((1+to as usize-from as usize).max(0));
382 for i in from as usize..=to as usize {385 for i in from as usize..=to as usize {
383 out.push(Val::Num(i as f64));386 out.push(Val::Num(i as f64));