From 55643f61d0a6b1d1f66fc8675fe3dbe417740b15 Mon Sep 17 00:00:00 2001 From: Ritchie Vink Date: Mon, 24 Oct 2022 13:00:48 +0200 Subject: [PATCH] chore(rust): update to rustc to nightly-2022-10-24 (#5312) --- .github/deploy_manylinux.sh | 2 +- .github/workflows/benchmark.yaml | 2 +- .github/workflows/build-test-rust.yaml | 6 +++--- .../create-py-release-mac-universal2.yaml | 2 +- .../create-py-release-manylinux-lts-cpu.yaml | 2 +- .../workflows/create-py-release-manylinux.yaml | 6 +++--- .../create-py-release-windows-macos.yaml | 2 +- .github/workflows/docs-deploy.yaml | 2 +- .github/workflows/lint-python.yaml | 2 +- .github/workflows/test-python.yaml | 4 ++-- polars/polars-arrow/src/compute/take/mod.rs | 6 +++--- .../src/kernels/rolling/no_nulls/mod.rs | 4 ++-- .../src/kernels/rolling/no_nulls/quantile.rs | 4 ++-- .../src/kernels/rolling/nulls/mod.rs | 3 +-- .../src/kernels/rolling/nulls/quantile.rs | 3 +-- .../src/chunked_array/object/extension/mod.rs | 2 +- .../src/chunked_array/ops/aggregate.rs | 2 +- .../polars-core/src/chunked_array/ops/shift.rs | 2 +- .../src/chunked_array/ops/unique/rank.rs | 2 +- polars/polars-core/src/datatypes/mod.rs | 2 +- polars/polars-core/src/fmt.rs | 2 +- polars/polars-core/src/frame/groupby/hashing.rs | 3 --- polars/polars-core/src/series/ops/ewm.rs | 11 +++-------- polars/polars-io/src/parquet/read_impl.rs | 16 ++++------------ .../polars-plan/src/dsl/function_expr/list.rs | 4 +--- .../src/logical_plan/optimizer/cse.rs | 2 +- .../src/physical_plan/expressions/apply.rs | 2 +- .../src/physical_plan/expressions/literal.rs | 4 ++-- .../src/physical_plan/expressions/slice.rs | 4 ++-- polars/polars-time/src/windows/duration.rs | 2 +- py-polars/src/conversion.rs | 6 +++--- py-polars/src/file.rs | 4 ++-- rust-toolchain.toml | 2 +- 33 files changed, 51 insertions(+), 71 deletions(-) diff --git a/.github/deploy_manylinux.sh b/.github/deploy_manylinux.sh index a5f5fd6e9637..eabeafd6f0b8 100644 --- a/.github/deploy_manylinux.sh +++ b/.github/deploy_manylinux.sh @@ -8,7 +8,7 @@ ls -la rm py-polars/README.md cp README.md py-polars/README.md cd py-polars -rustup override set nightly-2022-10-06 +rustup override set nightly-2022-10-24 export RUSTFLAGS='-C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma' # first the default release diff --git a/.github/workflows/benchmark.yaml b/.github/workflows/benchmark.yaml index 4217cf1f7851..4b4b3804839f 100644 --- a/.github/workflows/benchmark.yaml +++ b/.github/workflows/benchmark.yaml @@ -50,7 +50,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/build-test-rust.yaml b/.github/workflows/build-test-rust.yaml index 2ece2472e029..6ec55445f5df 100644 --- a/.github/workflows/build-test-rust.yaml +++ b/.github/workflows/build-test-rust.yaml @@ -34,7 +34,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 - name: Cache Rust uses: Swatinem/rust-cache@v2 @@ -58,7 +58,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 components: rustfmt, clippy, miri - name: Cache Rust @@ -102,7 +102,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/create-py-release-mac-universal2.yaml b/.github/workflows/create-py-release-mac-universal2.yaml index 9d14191c88f2..7ef0acb2cd72 100644 --- a/.github/workflows/create-py-release-mac-universal2.yaml +++ b/.github/workflows/create-py-release-mac-universal2.yaml @@ -26,7 +26,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 - name: Set up Rust targets run: rustup target add aarch64-apple-darwin diff --git a/.github/workflows/create-py-release-manylinux-lts-cpu.yaml b/.github/workflows/create-py-release-manylinux-lts-cpu.yaml index e1186af61e4d..7d389d3c6c82 100644 --- a/.github/workflows/create-py-release-manylinux-lts-cpu.yaml +++ b/.github/workflows/create-py-release-manylinux-lts-cpu.yaml @@ -32,7 +32,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt with: - rust-toolchain: nightly-2022-10-06 + rust-toolchain: nightly-2022-10-24 maturin-version: '0.13.5' command: publish args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46 diff --git a/.github/workflows/create-py-release-manylinux.yaml b/.github/workflows/create-py-release-manylinux.yaml index a5a00b7cf78c..f684ab480354 100644 --- a/.github/workflows/create-py-release-manylinux.yaml +++ b/.github/workflows/create-py-release-manylinux.yaml @@ -29,7 +29,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma with: - rust-toolchain: nightly-2022-10-06 + rust-toolchain: nightly-2022-10-24 maturin-version: '0.13.5' command: publish args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46 @@ -53,7 +53,7 @@ jobs: env: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} with: - rust-toolchain: nightly-2022-10-06 + rust-toolchain: nightly-2022-10-24 target: aarch64-unknown-linux-gnu maturin-version: '0.13.5' command: publish @@ -84,7 +84,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+ssse3,+sse4.1,+sse4.2,+popcnt,+avx,+fma with: - rust-toolchain: nightly-2022-10-06 + rust-toolchain: nightly-2022-10-24 maturin-version: '0.13.5' command: publish args: -m py-polars/Cargo.toml --skip-existing -o wheels -u ritchie46 diff --git a/.github/workflows/create-py-release-windows-macos.yaml b/.github/workflows/create-py-release-windows-macos.yaml index 9e2e74e77508..d88a8596119c 100644 --- a/.github/workflows/create-py-release-windows-macos.yaml +++ b/.github/workflows/create-py-release-windows-macos.yaml @@ -34,7 +34,7 @@ jobs: MATURIN_PASSWORD: ${{ secrets.PYPI_PASS }} RUSTFLAGS: -C target-feature=+fxsr,+sse,+sse2,+sse3,+sse4.1,+sse4.2 with: - rust-toolchain: nightly-2022-10-06 + rust-toolchain: nightly-2022-10-24 maturin-version: '0.13.5' command: publish args: -m py-polars/Cargo.toml --no-sdist --skip-existing -o wheels -i python -u ritchie46 diff --git a/.github/workflows/docs-deploy.yaml b/.github/workflows/docs-deploy.yaml index a52978bb0d91..51cde724f98f 100644 --- a/.github/workflows/docs-deploy.yaml +++ b/.github/workflows/docs-deploy.yaml @@ -30,7 +30,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 components: rust-docs - name: Cache Rust diff --git a/.github/workflows/lint-python.yaml b/.github/workflows/lint-python.yaml index ff691034b920..79067b4b1412 100644 --- a/.github/workflows/lint-python.yaml +++ b/.github/workflows/lint-python.yaml @@ -39,7 +39,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 components: rustfmt, clippy - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/.github/workflows/test-python.yaml b/.github/workflows/test-python.yaml index 1712f1e68b70..085ab8eb546d 100644 --- a/.github/workflows/test-python.yaml +++ b/.github/workflows/test-python.yaml @@ -50,7 +50,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 - name: Cache Rust uses: Swatinem/rust-cache@v2 @@ -112,7 +112,7 @@ jobs: - name: Set up Rust uses: dtolnay/rust-toolchain@master with: - toolchain: nightly-2022-10-06 + toolchain: nightly-2022-10-24 - name: Cache Rust uses: Swatinem/rust-cache@v2 diff --git a/polars/polars-arrow/src/compute/take/mod.rs b/polars/polars-arrow/src/compute/take/mod.rs index 7e653b5f8f38..d429482069d4 100644 --- a/polars/polars-arrow/src/compute/take/mod.rs +++ b/polars/polars-arrow/src/compute/take/mod.rs @@ -134,7 +134,7 @@ pub unsafe fn take_no_null_primitive_iter_unchecked 0 { - ((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len() as usize + ((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len() } else { 0 }; @@ -589,7 +589,7 @@ pub unsafe fn take_binary_unchecked( // Allocate 2.0 times the expected size. // where expected size is the length of bytes multiplied by the factor (take_len / current_len) let mut values_capacity = if arr.len() > 0 { - ((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len() as usize + ((arr.len() as f32 * 2.0) as usize) / arr.len() * indices.len() } else { 0 }; diff --git a/polars/polars-arrow/src/kernels/rolling/no_nulls/mod.rs b/polars/polars-arrow/src/kernels/rolling/no_nulls/mod.rs index 24921628b414..0a519932df6b 100644 --- a/polars/polars-arrow/src/kernels/rolling/no_nulls/mod.rs +++ b/polars/polars-arrow/src/kernels/rolling/no_nulls/mod.rs @@ -55,7 +55,7 @@ where }) .collect_trusted::>(); - let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn); + let validity = create_validity(min_periods, len, window_size, det_offsets_fn); Box::new(PrimitiveArray::from_data( T::PRIMITIVE.into(), out.into(), @@ -103,7 +103,7 @@ where }) .collect_trusted::>(); - let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn); + let validity = create_validity(min_periods, len, window_size, det_offsets_fn); Box::new(PrimitiveArray::from_data( DataType::from(T::PRIMITIVE), out.into(), diff --git a/polars/polars-arrow/src/kernels/rolling/no_nulls/quantile.rs b/polars/polars-arrow/src/kernels/rolling/no_nulls/quantile.rs index 72483327ec63..2220ee70d1e9 100644 --- a/polars/polars-arrow/src/kernels/rolling/no_nulls/quantile.rs +++ b/polars/polars-arrow/src/kernels/rolling/no_nulls/quantile.rs @@ -244,7 +244,7 @@ where }) .collect_trusted::>(); - let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn); + let validity = create_validity(min_periods, len, window_size, det_offsets_fn); Box::new(PrimitiveArray::from_data( T::PRIMITIVE.into(), out.into(), @@ -284,7 +284,7 @@ where }) .collect_trusted::>(); - let validity = create_validity(min_periods, len as usize, window_size, det_offsets_fn); + let validity = create_validity(min_periods, len, window_size, det_offsets_fn); Box::new(PrimitiveArray::from_data( T::PRIMITIVE.into(), out.into(), diff --git a/polars/polars-arrow/src/kernels/rolling/nulls/mod.rs b/polars/polars-arrow/src/kernels/rolling/nulls/mod.rs index 36967e970301..566ede7351f0 100644 --- a/polars/polars-arrow/src/kernels/rolling/nulls/mod.rs +++ b/polars/polars-arrow/src/kernels/rolling/nulls/mod.rs @@ -42,8 +42,7 @@ where // Safety; we are in bounds let mut agg_window = unsafe { Agg::new(values, validity, start, end) }; - let mut validity = match create_validity(min_periods, len as usize, window_size, det_offsets_fn) - { + let mut validity = match create_validity(min_periods, len, window_size, det_offsets_fn) { Some(v) => v, None => { let mut validity = MutableBitmap::with_capacity(len); diff --git a/polars/polars-arrow/src/kernels/rolling/nulls/quantile.rs b/polars/polars-arrow/src/kernels/rolling/nulls/quantile.rs index 8c17543fecf2..d140dafe946d 100644 --- a/polars/polars-arrow/src/kernels/rolling/nulls/quantile.rs +++ b/polars/polars-arrow/src/kernels/rolling/nulls/quantile.rs @@ -104,8 +104,7 @@ where // we are in bounds let mut sorted_window = unsafe { SortedBufNulls::new(values, bitmap, start, end) }; - let mut validity = match create_validity(min_periods, len as usize, window_size, det_offsets_fn) - { + let mut validity = match create_validity(min_periods, len, window_size, det_offsets_fn) { Some(v) => v, None => { let mut validity = MutableBitmap::with_capacity(len); diff --git a/polars/polars-core/src/chunked_array/object/extension/mod.rs b/polars/polars-core/src/chunked_array/object/extension/mod.rs index a7ceabac146f..89afe3b74d85 100644 --- a/polars/polars-core/src/chunked_array/object/extension/mod.rs +++ b/polars/polars-core/src/chunked_array/object/extension/mod.rs @@ -20,7 +20,7 @@ unsafe fn create_drop(mut ptr: *const u8, n_t_vals: usize) -> Box() as isize; for _ in 0..n_t_vals { let _ = std::ptr::read_unaligned(ptr as *const T); - ptr = ptr.offset(t_size as isize) + ptr = ptr.offset(t_size) } }) } diff --git a/polars/polars-core/src/chunked_array/ops/aggregate.rs b/polars/polars-core/src/chunked_array/ops/aggregate.rs index 49e0f912eeb8..d7e29264cf49 100644 --- a/polars/polars-core/src/chunked_array/ops/aggregate.rs +++ b/polars/polars-core/src/chunked_array/ops/aggregate.rs @@ -179,7 +179,7 @@ fn quantile_idx( } }; - base_idx = std::cmp::min(std::cmp::max(base_idx, 0), (length - 1) as i64); + base_idx = base_idx.clamp(0, (length - 1) as i64); let float_idx = ((length - null_count) as f64 - 1.0) * quantile + null_count as f64; let top_idx = f64::ceil(float_idx) as i64; diff --git a/polars/polars-core/src/chunked_array/ops/shift.rs b/polars/polars-core/src/chunked_array/ops/shift.rs index 450f62b3d322..c6a72bf3f424 100644 --- a/polars/polars-core/src/chunked_array/ops/shift.rs +++ b/polars/polars-core/src/chunked_array/ops/shift.rs @@ -85,7 +85,7 @@ impl ChunkShiftFill> for ListChunked { // This has its own implementation because a ListChunked cannot have a full-null without // knowing the inner type let periods = clamp(periods, -(self.len() as i64), self.len() as i64); - let slice_offset = (-periods).max(0) as i64; + let slice_offset = (-periods).max(0); let length = self.len() - abs(periods) as usize; let mut slice = self.slice(slice_offset, length); diff --git a/polars/polars-core/src/chunked_array/ops/unique/rank.rs b/polars/polars-core/src/chunked_array/ops/unique/rank.rs index 2f09a7ad8aa5..d8d6289a6a17 100644 --- a/polars/polars-core/src/chunked_array/ops/unique/rank.rs +++ b/polars/polars-core/src/chunked_array/ops/unique/rank.rs @@ -145,7 +145,7 @@ pub(crate) fn rank(s: &Series, method: RankMethod, reverse: bool) -> Series { let rng = &mut SmallRng::from_rng(&mut thread_rng).unwrap(); // Shuffle sort_idx positions which point to ties in the original series. - for i in 0..(ties_indices.len() - 1) as usize { + for i in 0..(ties_indices.len() - 1) { let ties_index_start = ties_indices[i]; let ties_index_end = ties_indices[i + 1]; if ties_index_end - ties_index_start > 1 { diff --git a/polars/polars-core/src/datatypes/mod.rs b/polars/polars-core/src/datatypes/mod.rs index 79069658197a..792d9c8e3851 100644 --- a/polars/polars-core/src/datatypes/mod.rs +++ b/polars/polars-core/src/datatypes/mod.rs @@ -856,7 +856,7 @@ impl<'a> From> for Option { match val { Null => None, Int32(v) => Some(v as i64), - Int64(v) => Some(v as i64), + Int64(v) => Some(v), UInt32(v) => Some(v as i64), _ => todo!(), } diff --git a/polars/polars-core/src/fmt.rs b/polars/polars-core/src/fmt.rs index 2c1489044749..5b1f3cdcce3e 100644 --- a/polars/polars-core/src/fmt.rs +++ b/polars/polars-core/src/fmt.rs @@ -372,7 +372,7 @@ impl Display for DataFrame { let field_to_str = |f: &Field| { let name = make_str_val(f.name(), str_truncate); - let lower_bounds = std::cmp::max(5, std::cmp::min(12, name.len())); + let lower_bounds = name.len().clamp(5, 12); let mut column_name = name; if env_is_true(FMT_TABLE_HIDE_COLUMN_NAMES) { column_name = "".to_string(); diff --git a/polars/polars-core/src/frame/groupby/hashing.rs b/polars/polars-core/src/frame/groupby/hashing.rs index 68c638f1031c..c30c3fac3268 100644 --- a/polars/polars-core/src/frame/groupby/hashing.rs +++ b/polars/polars-core/src/frame/groupby/hashing.rs @@ -109,8 +109,6 @@ where let out = POOL .install(|| { (0..n_partitions).into_par_iter().map(|thread_no| { - let thread_no = thread_no as u64; - let mut hash_tbl: PlHashMap)> = PlHashMap::with_capacity(HASHMAP_INIT_SIZE); @@ -301,7 +299,6 @@ pub(crate) fn groupby_threaded_multiple_keys_flat( .install(|| { (0..n_partitions).into_par_iter().map(|thread_no| { let hashes = &hashes; - let thread_no = thread_no as u64; let mut hash_tbl: HashMap), IdBuildHasher> = HashMap::with_capacity_and_hasher(HASHMAP_INIT_SIZE, Default::default()); diff --git a/polars/polars-core/src/series/ops/ewm.rs b/polars/polars-core/src/series/ops/ewm.rs index a1827771213c..d5e70575b6ed 100644 --- a/polars/polars-core/src/series/ops/ewm.rs +++ b/polars/polars-core/src/series/ops/ewm.rs @@ -25,12 +25,7 @@ impl Series { } DataType::Float64 => { let xs = self.f64().unwrap(); - let result = ewm_mean( - xs, - options.alpha as f64, - options.adjust, - options.min_periods, - ); + let result = ewm_mean(xs, options.alpha, options.adjust, options.min_periods); Series::try_from((self.name(), Box::new(result) as ArrayRef)) } _ => self.cast(&DataType::Float64)?.ewm_mean(options), @@ -59,7 +54,7 @@ impl Series { let xs = self.f64().unwrap(); let result = ewm_std( xs, - options.alpha as f64, + options.alpha, options.adjust, options.bias, options.min_periods, @@ -92,7 +87,7 @@ impl Series { let xs = self.f64().unwrap(); let result = ewm_var( xs, - options.alpha as f64, + options.alpha, options.adjust, options.bias, options.min_periods, diff --git a/polars/polars-io/src/parquet/read_impl.rs b/polars/polars-io/src/parquet/read_impl.rs index 1038a9f02e0e..9f67e684057d 100644 --- a/polars/polars-io/src/parquet/read_impl.rs +++ b/polars/polars-io/src/parquet/read_impl.rs @@ -103,7 +103,7 @@ fn rg_to_dfs( assert!(std::env::var("POLARS_PANIC_IF_PARQUET_PARSED").is_err()) } - let chunk_size = md.num_rows() as usize; + let chunk_size = md.num_rows(); let columns = if let ParallelStrategy::Columns = parallel { POOL.install(|| { projection @@ -129,8 +129,7 @@ fn rg_to_dfs( .collect::>>()? }; - *remaining_rows = - remaining_rows.saturating_sub(file_metadata.row_groups[rg].num_rows() as usize); + *remaining_rows = remaining_rows.saturating_sub(file_metadata.row_groups[rg].num_rows()); let mut df = DataFrame::new_no_checks(columns); if let Some(rc) = &row_count { @@ -195,18 +194,11 @@ fn rg_to_dfs_par( assert!(std::env::var("POLARS_PANIC_IF_PARQUET_PARSED").is_err()) } - let chunk_size = md.num_rows() as usize; + let chunk_size = md.num_rows(); let columns = projection .iter() .map(|column_i| { - column_idx_to_series( - *column_i, - md, - local_limit as usize, - schema, - bytes, - chunk_size, - ) + column_idx_to_series(*column_i, md, local_limit, schema, bytes, chunk_size) }) .collect::>>()?; diff --git a/polars/polars-lazy/polars-plan/src/dsl/function_expr/list.rs b/polars/polars-lazy/polars-plan/src/dsl/function_expr/list.rs index e2543bc76d79..072189b90874 100644 --- a/polars/polars-lazy/polars-plan/src/dsl/function_expr/list.rs +++ b/polars/polars-lazy/polars-plan/src/dsl/function_expr/list.rs @@ -77,9 +77,7 @@ pub(super) fn slice(args: &mut [Series]) -> PolarsResult { .amortized_iter() .zip(offset_ca) .map(|(opt_s, opt_offset)| match (opt_s, opt_offset) { - (Some(s), Some(offset)) => { - Some(s.as_ref().slice(offset, length_slice as usize)) - } + (Some(s), Some(offset)) => Some(s.as_ref().slice(offset, length_slice)), _ => None, }) .collect_trusted() diff --git a/polars/polars-lazy/polars-plan/src/logical_plan/optimizer/cse.rs b/polars/polars-lazy/polars-plan/src/logical_plan/optimizer/cse.rs index d27a59da50b6..6a37bd55f467 100644 --- a/polars/polars-lazy/polars-plan/src/logical_plan/optimizer/cse.rs +++ b/polars/polars-lazy/polars-plan/src/logical_plan/optimizer/cse.rs @@ -344,7 +344,7 @@ pub(crate) fn elim_cmn_subplans( cache_mapping.insert(node2, cache_id); cache_id } - } as usize; + }; // reassign old nodes to another location as we are going to replace // them with a cache node diff --git a/polars/polars-lazy/src/physical_plan/expressions/apply.rs b/polars/polars-lazy/src/physical_plan/expressions/apply.rs index 8e8085c7f6af..f4d877de5930 100644 --- a/polars/polars-lazy/src/physical_plan/expressions/apply.rs +++ b/polars/polars-lazy/src/physical_plan/expressions/apply.rs @@ -78,7 +78,7 @@ fn all_unit_length(ca: &ListChunked) -> bool { assert_eq!(ca.chunks().len(), 1); let list_arr = ca.downcast_iter().next().unwrap(); let offset = list_arr.offsets().as_slice(); - (offset[offset.len() - 1] as usize) == list_arr.len() as usize + (offset[offset.len() - 1] as usize) == list_arr.len() } fn check_map_output_len(input_len: usize, output_len: usize, expr: &Expr) -> PolarsResult<()> { diff --git a/polars/polars-lazy/src/physical_plan/expressions/literal.rs b/polars/polars-lazy/src/physical_plan/expressions/literal.rs index 9d16fd69deda..3cd68a498a25 100644 --- a/polars/polars-lazy/src/physical_plan/expressions/literal.rs +++ b/polars/polars-lazy/src/physical_plan/expressions/literal.rs @@ -51,8 +51,8 @@ impl PhysicalExpr for LiteralExpr { ca.into_inner().into_series() } DataType::Int64 => { - let low = *low as i64; - let high = *high as i64; + let low = *low; + let high = *high; let ca: NoNull = (low..high).collect(); ca.into_inner().into_series() } diff --git a/polars/polars-lazy/src/physical_plan/expressions/slice.rs b/polars/polars-lazy/src/physical_plan/expressions/slice.rs index 84b208daef0a..2d7d89b1b617 100644 --- a/polars/polars-lazy/src/physical_plan/expressions/slice.rs +++ b/polars/polars-lazy/src/physical_plan/expressions/slice.rs @@ -82,7 +82,7 @@ fn slice_groups_idx(offset: i64, length: usize, first: IdxSize, idx: &[IdxSize]) } fn slice_groups_slice(offset: i64, length: usize, first: IdxSize, len: IdxSize) -> [IdxSize; 2] { - let (offset, len) = slice_offsets(offset, length as usize, len as usize); + let (offset, len) = slice_offsets(offset, length, len as usize); [first + offset as IdxSize, len as IdxSize] } @@ -197,7 +197,7 @@ impl PhysicalExpr for SliceExpr { .iter() .zip(offset.into_no_null_iter()) .map(|((first, idx), offset)| { - slice_groups_idx(offset, length as usize, first, idx) + slice_groups_idx(offset, length, first, idx) }) .collect(); GroupsProxy::Idx(groups) diff --git a/polars/polars-time/src/windows/duration.rs b/polars/polars-time/src/windows/duration.rs index 8f431cef895b..8ff2e3704163 100644 --- a/polars/polars-time/src/windows/duration.rs +++ b/polars/polars-time/src/windows/duration.rs @@ -272,7 +272,7 @@ impl Duration { // determine the total number of months and truncate // the number of months by the duration amount - let mut total = (year * 12) as i32 + (month - 1) as i32; + let mut total = (year * 12) + (month as i32 - 1); let remainder = total % self.months as i32; total -= remainder; diff --git a/py-polars/src/conversion.rs b/py-polars/src/conversion.rs index 4d27e3240c18..6fa3340c9f13 100644 --- a/py-polars/src/conversion.rs +++ b/py-polars/src/conversion.rs @@ -65,7 +65,7 @@ impl From for Wrap { pub(crate) fn get_pyseq(obj: &PyAny) -> PyResult<(&PySequence, usize)> { let seq = ::try_from(obj)?; - let len = seq.len()? as usize; + let len = seq.len()?; Ok((seq, len)) } @@ -743,7 +743,7 @@ impl Default for ObjectValue { impl<'a, T: NativeType + FromPyObject<'a>> FromPyObject<'a> for Wrap> { fn extract(obj: &'a PyAny) -> PyResult { let seq = ::try_from(obj)?; - let mut v = Vec::with_capacity(seq.len().unwrap_or(0) as usize); + let mut v = Vec::with_capacity(seq.len().unwrap_or(0)); for item in seq.iter()? { v.push(item?.extract::()?); } @@ -1103,7 +1103,7 @@ pub(crate) fn parse_parquet_compression( "zstd" => ParquetCompression::Zstd( compression_level .map(|lvl| { - ZstdLevel::try_new(lvl as i32) + ZstdLevel::try_new(lvl) .map_err(|e| PyValueError::new_err(format!("{:?}", e))) }) .transpose()?, diff --git a/py-polars/src/file.rs b/py-polars/src/file.rs index 4c7374fdcc12..aa460a4845ab 100644 --- a/py-polars/src/file.rs +++ b/py-polars/src/file.rs @@ -166,8 +166,8 @@ impl Seek for PyFileLikeObject { Python::with_gil(|py| { let (whence, offset) = match pos { SeekFrom::Start(i) => (0, i as i64), - SeekFrom::Current(i) => (1, i as i64), - SeekFrom::End(i) => (2, i as i64), + SeekFrom::Current(i) => (1, i), + SeekFrom::End(i) => (2, i), }; let new_position = self diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 005f62eb3560..288e9f5cdfe2 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "nightly-2022-10-06" +channel = "nightly-2022-10-24"