Skip to content

Commit 4c8b913

Browse files
authored
Shows e-exprs inside container literals, delimited END (#186)
* Shows e-exprs inside container literals, delimited END * Improves rendering of eexps, arg groups, comments * Upgrade ion-rs to rc.11
1 parent 00fbcdb commit 4c8b913

File tree

10 files changed

+662
-568
lines changed

10 files changed

+662
-568
lines changed

Cargo.lock

Lines changed: 207 additions & 203 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ flate2 = "1.0"
2121
infer = "0.15.0"
2222
# ion-rs version must be pinned because we are using experimental features
2323
# See https://github.com/amazon-ion/ion-cli/issues/155
24-
ion-rs = { version = "1.0.0-rc.10", features = ["experimental", "experimental-ion-hash"] }
24+
ion-rs = { version = "1.0.0-rc.11", features = ["experimental", "experimental-ion-hash"] }
2525
tempfile = "3.2.0"
2626
ion-schema = "0.15.0"
2727
lowcharts = "0.5.8"

src/bin/ion/commands/generate/generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a> CodeGenerator<'a, JavaLanguage> {
105105
}
106106
}
107107

108-
impl<'a, L: Language + 'static> CodeGenerator<'a, L> {
108+
impl<L: Language + 'static> CodeGenerator<'_, L> {
109109
/// A [tera] filter that converts given tera string value to [upper camel case].
110110
/// Returns error if the given value is not a string.
111111
///

src/bin/ion/commands/hash.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use ion_rs::ion_hash::IonHasher;
66
use ion_rs::*;
77
use sha2::{Sha256, Sha512};
88
use sha3::{Sha3_256, Sha3_512};
9+
use std::fmt;
910
use std::io::Write;
1011

1112
// Macro to eliminate repetitive code for each hash algorithm.
@@ -109,8 +110,14 @@ impl IonCliCommand for HashCommand {
109110
for elem in reader.elements() {
110111
let elem = elem?;
111112
let digest = hasher.hash_it(&elem)?;
112-
let digest_string: String =
113-
digest.iter().map(|b| format!("{:02x?}", b)).collect();
113+
let digest_string = digest.iter().fold(
114+
String::with_capacity(digest.len() * 2),
115+
|mut string, byte| {
116+
use fmt::Write;
117+
write!(&mut string, "{:02x}", byte).expect("infallible");
118+
string
119+
},
120+
);
114121
output.write_all(digest_string.as_bytes())?;
115122
output.write_all("\n".as_bytes())?;
116123
}

0 commit comments

Comments
 (0)