Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Update Rust toolchain to nightly-2024-07-26 #17891

Merged
merged 6 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
438 changes: 213 additions & 225 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions crates/polars-arrow/src/array/dictionary/typed_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,12 @@ impl<O: Offset> DictValue for Utf8Array<O> {
.ok_or_else(
|| polars_err!(InvalidOperation: "could not convert array to dictionary value"),
)
.map(|arr| {
.inspect(|arr| {
assert_eq!(
arr.null_count(),
0,
"null values in values not supported in iteration"
);
arr
)
})
}
}
Expand All @@ -65,13 +64,12 @@ impl DictValue for Utf8ViewArray {
.ok_or_else(
|| polars_err!(InvalidOperation: "could not convert array to dictionary value"),
)
.map(|arr| {
.inspect(|arr| {
assert_eq!(
arr.null_count(),
0,
"null values in values not supported in iteration"
);
arr
)
})
}
}
Expand Down
3 changes: 1 addition & 2 deletions crates/polars-arrow/src/scalar/fixed_size_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ impl FixedSizeListScalar {
pub fn new(data_type: ArrowDataType, values: Option<Box<dyn Array>>) -> Self {
let (field, size) = FixedSizeListArray::get_child_and_size(&data_type);
let inner_data_type = field.data_type();
let values = values.map(|x| {
let values = values.inspect(|x| {
assert_eq!(inner_data_type, x.data_type());
assert_eq!(size, x.len());
x
});
Self { values, data_type }
}
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-core/src/frame/row/av_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ impl<'a> AnyValueBuffer<'a> {

// dynamic types
(String(builder), av) => match av {
AnyValue::Int64(v) => builder.append_value(&format!("{v}")),
AnyValue::Float64(v) => builder.append_value(&format!("{v}")),
AnyValue::Int64(v) => builder.append_value(format!("{v}")),
AnyValue::Float64(v) => builder.append_value(format!("{v}")),
AnyValue::Boolean(true) => builder.append_value("true"),
AnyValue::Boolean(false) => builder.append_value("false"),
_ => return None,
Expand Down
9 changes: 4 additions & 5 deletions crates/polars-expr/src/expressions/binary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,13 +435,12 @@ mod stats {
// Default: read the file
_ => Ok(true),
};
out.map(|read| {
if state.verbose() && read {
out.inspect(|read| {
if state.verbose() && *read {
eprintln!("parquet file must be read, statistics not sufficient for predicate.")
} else if state.verbose() && !read {
} else if state.verbose() && !*read {
eprintln!("parquet file can be skipped, the statistics were sufficient to apply the predicate.")
};
read
}
})
}
}
Expand Down
4 changes: 3 additions & 1 deletion crates/polars-io/src/pl_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@ impl<T: GetSize, E: Error> GetSize for Result<T, E> {
}
}

#[cfg(feature = "cloud")]
pub(crate) struct Size(u64);

#[cfg(feature = "cloud")]
impl GetSize for Size {
fn size(&self) -> u64 {
self.0
}
}

#[cfg(feature = "cloud")]
impl From<u64> for Size {
fn from(value: u64) -> Self {
Self(value)
Expand Down
6 changes: 3 additions & 3 deletions crates/polars-json/src/json/write/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ where
W: std::io::Write,
I: FallibleStreamingIterator<Item = [u8], Error = PolarsError>,
{
writer.write_all(&[b'['])?;
writer.write_all(b"[")?;
let mut is_first_row = true;
while let Some(block) = blocks.next()? {
if !is_first_row {
writer.write_all(&[b','])?;
writer.write_all(b",")?;
}
is_first_row = false;
writer.write_all(block)?;
}
writer.write_all(&[b']'])?;
writer.write_all(b"]")?;
Ok(())
}
5 changes: 1 addition & 4 deletions crates/polars-parquet/src/arrow/write/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,7 @@ impl<T, I: Iterator<Item = T>> Iterator for ExactSizedIter<T, I> {

#[inline]
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(|x| {
self.remaining -= 1;
x
})
self.iter.next().inspect(|_| self.remaining -= 1)
}

#[inline]
Expand Down
4 changes: 2 additions & 2 deletions crates/polars-pipe/src/executors/sinks/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn get_spill_dir(operation_name: &'static str) -> PolarsResult<PathBuf> {
let id = uuid::Uuid::new_v4();

let mut dir = std::path::PathBuf::from(get_base_temp_dir());
dir.push(&format!("polars/{operation_name}/{id}"));
dir.push(format!("polars/{operation_name}/{id}"));

if !dir.exists() {
fs::create_dir_all(&dir).map_err(|err| {
Expand Down Expand Up @@ -77,7 +77,7 @@ fn gc_thread(operation_name: &'static str, rx: Receiver<PathBuf>) {
let _ = std::thread::spawn(move || {
// First clean all existing
let mut dir = std::path::PathBuf::from(get_base_temp_dir());
dir.push(&format!("polars/{operation_name}"));
dir.push(format!("polars/{operation_name}"));

// if the directory does not exist, there is nothing to clean
let rd = match std::fs::read_dir(&dir) {
Expand Down
7 changes: 3 additions & 4 deletions crates/polars-pipe/src/executors/sources/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,9 @@ impl CsvSource {
let options = self.options.clone().unwrap();
let mut with_columns = file_options.with_columns;
let mut projected_len = 0;
with_columns.as_ref().map(|columns| {
projected_len = columns.len();
columns
});
with_columns
.as_ref()
.inspect(|columns| projected_len = columns.len());

if projected_len == 0 {
with_columns = None;
Expand Down
7 changes: 3 additions & 4 deletions crates/polars-plan/src/client/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,9 @@ impl<'a> Iterator for DslPlanIter<'a> {
type Item = &'a DslPlan;

fn next(&mut self) -> Option<Self::Item> {
self.stack.pop().map(|next| {
next.inputs(&mut self.stack);
next
})
self.stack
.pop()
.inspect(|next| next.inputs(&mut self.stack))
}
}

Expand Down
7 changes: 3 additions & 4 deletions crates/polars-plan/src/plans/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,9 @@ impl<'a> Iterator for ExprIter<'a> {
type Item = &'a Expr;

fn next(&mut self) -> Option<Self::Item> {
self.stack.pop().map(|current_expr| {
current_expr.nodes(&mut self.stack);
current_expr
})
self.stack
.pop()
.inspect(|current_expr| current_expr.nodes(&mut self.stack))
}
}

Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2024-06-23"
channel = "nightly-2024-07-26"