Skip to content

Commit 61fdc9e

Browse files
committed
[FIX] fix cargo fmt tests
1 parent f02c184 commit 61fdc9e

File tree

6 files changed

+353
-210
lines changed

6 files changed

+353
-210
lines changed

parquet-variant/examples/variant_to_json_examples.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717

1818
//! Example showing how to convert Variant values to JSON
1919
20-
use parquet_variant::{
21-
variant_to_json, variant_to_json_string, variant_to_json_value, Variant,
22-
};
20+
use parquet_variant::{variant_to_json, variant_to_json_string, variant_to_json_value, Variant};
2321

2422
fn main() -> Result<(), Box<dyn std::error::Error>> {
2523
let variants = vec![
@@ -39,12 +37,13 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3937

4038
// Example 2: String escaping
4139
println!("\n🔤 2. String Escaping:");
42-
43-
let special_string = Variant::String("Line 1\nLine 2\tTabbed\r\nWith \"quotes\" and \\backslashes");
40+
41+
let special_string =
42+
Variant::String("Line 1\nLine 2\tTabbed\r\nWith \"quotes\" and \\backslashes");
4443
let escaped_json = variant_to_json_string(&special_string)?;
4544
println!(" Original: Line 1\\nLine 2\\tTabbed\\r\\nWith \"quotes\" and \\\\backslashes");
4645
println!(" JSON: {}", escaped_json);
47-
46+
4847
let unicode_variants = vec![
4948
Variant::String("Hello 世界 🌍"),
5049
Variant::String("Emoji: 💻"),
@@ -55,25 +54,25 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
5554
let json_string = variant_to_json_string(&variant)?;
5655
println!(" {}", json_string);
5756
}
58-
57+
5958
let test_variant = Variant::String("Buffer test");
60-
59+
6160
// Write to Vec<u8>
6261
let mut vec_buffer = Vec::new();
6362
variant_to_json(&mut vec_buffer, &test_variant)?;
6463
println!(" Vec<u8> buffer: {}", String::from_utf8(vec_buffer)?);
65-
64+
6665
// Write to String (through write! macro)
6766
let mut string_buffer = String::new();
6867
use std::fmt::Write;
6968
write!(string_buffer, "Prefix: ")?;
70-
69+
7170
// Convert to bytes temporarily to use the Write trait
7271
let mut temp_buffer = Vec::new();
7372
variant_to_json(&mut temp_buffer, &test_variant)?;
7473
string_buffer.push_str(&String::from_utf8(temp_buffer)?);
7574
println!(" String buffer: {}", string_buffer);
76-
75+
7776
let variants_for_value = vec![
7877
Variant::Null,
7978
Variant::BooleanTrue,
@@ -85,15 +84,15 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
8584
let json_value = variant_to_json_value(&variant)?;
8685
println!(" {:?} -> {:?}", variant, json_value);
8786
}
88-
87+
8988
let start = std::time::Instant::now();
9089
for i in 0..1000 {
9190
let variant = Variant::Int8((i % 128) as i8);
9291
let _json = variant_to_json_string(&variant)?;
9392
}
9493
let duration = start.elapsed();
9594
println!(" Converted 1000 variants in {:?}", duration);
96-
95+
9796
// This would demonstrate error handling if we had invalid variants
9897
// For now, all our examples work, so we'll just show the pattern
9998
match variant_to_json_string(&Variant::String("Valid string")) {
@@ -102,4 +101,4 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
102101
}
103102

104103
Ok(())
105-
}
104+
}

parquet-variant/src/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717

1818
//! Encoder module for converting Variant values to other formats
1919
20-
pub mod variant_to_json;
20+
pub mod variant_to_json;

0 commit comments

Comments
 (0)