From 6208f2676bcbfbe5e7a6981ed763960d0df80b94 Mon Sep 17 00:00:00 2001 From: Nicolas Patry Date: Thu, 24 Aug 2023 17:29:01 +0200 Subject: [PATCH] Clippy. --- .github/workflows/python-release.yml | 18 ++++++++++++++++-- bindings/python/src/lib.rs | 2 +- safetensors/src/tensor.rs | 2 +- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 3f9c690e..081a8f91 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -130,13 +130,27 @@ jobs: # with: # name: pypi_files # path: dist - + build-sdist: + name: build sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: PyO3/maturin-action@v1 + with: + command: sdist + args: --out dist + rust-toolchain: stable + - name: Upload wheels + shell: bash + run: | + pip install awscli + aws s3 sync --exact-timestamps ./bindings/python/dist "s3://safetensors-releases/python/$DIST_DIR" upload_package: name: Upload package to PyPi runs-on: ubuntu-latest - needs: [build] + needs: [build, build-sdist] steps: - uses: actions/checkout@v3 diff --git a/bindings/python/src/lib.rs b/bindings/python/src/lib.rs index e7069fb0..ce66fba2 100644 --- a/bindings/python/src/lib.rs +++ b/bindings/python/src/lib.rs @@ -95,7 +95,7 @@ fn serialize<'b>( metadata: Option>, ) -> PyResult<&'b PyBytes> { let tensors = prepare(tensor_dict)?; - let metadata_map = metadata.map(|data| HashMap::from_iter(data.into_iter())); + let metadata_map = metadata.map(HashMap::from_iter); let out = safetensors::tensor::serialize(&tensors, &metadata_map) .map_err(|e| SafetensorError::new_err(format!("Error while serializing: {e:?}")))?; let pybytes = PyBytes::new(py, &out); diff --git a/safetensors/src/tensor.rs b/safetensors/src/tensor.rs index 2c1925e9..464d09a6 100644 --- a/safetensors/src/tensor.rs +++ b/safetensors/src/tensor.rs @@ -726,7 +726,7 @@ mod tests { let mut start = 0; let tensors: Vec = dtypes .iter() - .zip(shapes.into_iter()) + .zip(shapes) .map(|(dtype, shape)| { // This cannot overflow because the size of // the vector and elements are so small.