Skip to content
This repository has been archived by the owner on Feb 18, 2024. It is now read-only.

Commit

Permalink
Use join instead of open-coding it
Browse files Browse the repository at this point in the history
  • Loading branch information
simonvandel committed Oct 30, 2021
1 parent ad5f95d commit 62a728c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/ffi/schema.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
use std::{collections::BTreeMap, convert::TryInto, ffi::CStr, ffi::CString, ptr};

use itertools::Itertools;

use crate::{
datatypes::{DataType, Extension, Field, IntervalUnit, Metadata, TimeUnit},
error::{ArrowError, Result},
Expand Down Expand Up @@ -401,13 +403,11 @@ fn to_format(data_type: &DataType) -> String {
let sparsness = if *is_sparse { 's' } else { 'd' };
let mut r = format!("+u{}:", sparsness);
let ids = if let Some(ids) = ids {
ids.iter()
.fold(String::new(), |a, b| a + &b.to_string() + ",")
ids.iter().map(|x| x.to_string()).join(",")
} else {
(0..f.len()).fold(String::new(), |a, b| a + &b.to_string() + ",")
(0..f.len()).map(|x| x.to_string()).join(",")
};
let ids = &ids[..ids.len() - 1]; // take away last ","
r.push_str(ids);
r.push_str(&ids);
r
}
DataType::Map(_, _) => "+m".to_string(),
Expand Down

0 comments on commit 62a728c

Please sign in to comment.