Skip to content

Commit

Permalink
chore: Use or_else for raising (#18206)
Browse files Browse the repository at this point in the history
  • Loading branch information
ritchie46 committed Aug 15, 2024
1 parent 4157e92 commit fe21f4a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/polars-core/src/chunked_array/ops/append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ where
self.length = self
.length
.checked_add(other.length)
.ok_or(polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
.ok_or_else(|| polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
self.null_count += other.null_count;
new_chunks(&mut self.chunks, &other.chunks, len);
Ok(())
Expand All @@ -161,7 +161,7 @@ impl ListChunked {
self.length = self
.length
.checked_add(other.length)
.ok_or(polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
.ok_or_else(|| polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
self.null_count += other.null_count;
new_chunks(&mut self.chunks, &other.chunks, len);
self.set_sorted_flag(IsSorted::Not);
Expand All @@ -184,7 +184,7 @@ impl ArrayChunked {
self.length = self
.length
.checked_add(other.length)
.ok_or(polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
.ok_or_else(|| polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
self.null_count += other.null_count;

new_chunks(&mut self.chunks, &other.chunks, len);
Expand All @@ -205,7 +205,7 @@ impl StructChunked {
self.length = self
.length
.checked_add(other.length)
.ok_or(polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
.ok_or_else(|| polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
self.null_count += other.null_count;

new_chunks(&mut self.chunks, &other.chunks, len);
Expand All @@ -222,7 +222,7 @@ impl<T: PolarsObject> ObjectChunked<T> {
self.length = self
.length
.checked_add(other.length)
.ok_or(polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
.ok_or_else(|| polars_err!(ComputeError: LENGTH_LIMIT_MSG))?;
self.null_count += other.null_count;
self.set_sorted_flag(IsSorted::Not);
new_chunks(&mut self.chunks, &other.chunks, len);
Expand Down

0 comments on commit fe21f4a

Please sign in to comment.