Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scMarkus committed Aug 22, 2023
1 parent 99b040b commit 11dc548
Showing 1 changed file with 2 additions and 17 deletions.
19 changes: 2 additions & 17 deletions lib/codecs/src/encoding/format/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ impl CsvSerializerOptions {
/// Serializer that converts an `Event` to bytes using the CSV format.
#[derive(Debug, Clone)]
pub struct CsvSerializer {
// Box because of clippy error: 'large size difference between variants'
// in SerializerConfig enum
writer: Box<csv_core::Writer>,
fields: Vec<ConfigTargetPath>,
internal_buffer: Vec<u8>,
Expand Down Expand Up @@ -542,23 +544,6 @@ mod tests {
assert_eq!(bytes.freeze(), b"$foo \" $$ bar$".as_slice());
}

#[test]
fn custom_quote_style() {
let (fields, event) = make_event_with_fields(vec![("field1", "foo\"bar")]);
let opts = CsvSerializerOptions {
fields,
quote_style: QuoteStyle::Never,
..Default::default()
};
let config = CsvSerializerConfig::new(opts);
let mut serializer = config.build().unwrap();
let mut bytes = BytesMut::new();

serializer.encode(event, &mut bytes).unwrap();

assert_eq!(bytes.freeze(), b"foo\"bar".as_slice());
}

#[test]
fn more_input_then_capacity() {
let (fields, event) = make_event_with_fields(vec![("field1", "foo bar")]);
Expand Down

0 comments on commit 11dc548

Please sign in to comment.