Skip to content

Commit 5eecd29

Browse files
authored
Fixing clippy in 1.89 (#644)
1 parent 94f5d38 commit 5eecd29

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

bindings/python/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct PyView<'a> {
3333
}
3434

3535
impl View for &PyView<'_> {
36-
fn data(&self) -> std::borrow::Cow<[u8]> {
36+
fn data(&self) -> std::borrow::Cow<'_, [u8]> {
3737
Cow::Borrowed(self.data.as_bytes())
3838
}
3939
fn shape(&self) -> &[usize] {

safetensors/src/tensor.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ struct PreparedData {
142142
/// fn shape(&self) -> &[usize]{
143143
/// &self.shape
144144
/// }
145-
/// fn data(&self) -> Cow<[u8]>{
145+
/// fn data(&self) -> Cow<'_, [u8]>{
146146
/// (&self.data).into()
147147
/// }
148148
/// fn data_len(&self) -> usize{
@@ -166,7 +166,7 @@ struct PreparedData {
166166
/// fn shape(&self) -> &[usize]{
167167
/// &self.shape
168168
/// }
169-
/// fn data(&self) -> Cow<[u8]>{
169+
/// fn data(&self) -> Cow<'_, [u8]>{
170170
/// self.data.into()
171171
/// }
172172
/// fn data_len(&self) -> usize{
@@ -193,7 +193,7 @@ struct PreparedData {
193193
/// fn shape(&self) -> &[usize]{
194194
/// &self.shape
195195
/// }
196-
/// fn data(&self) -> Cow<[u8]>{
196+
/// fn data(&self) -> Cow<'_, [u8]>{
197197
/// // This copies data from GPU to CPU.
198198
/// let data: Vec<u8> = self.data.to_vec();
199199
/// data.into()
@@ -211,7 +211,7 @@ pub trait View {
211211
/// The shape of the tensor
212212
fn shape(&self) -> &[usize];
213213
/// The data of the tensor
214-
fn data(&self) -> Cow<[u8]>;
214+
fn data(&self) -> Cow<'_, [u8]>;
215215
/// The length of the data, in bytes.
216216
/// This is necessary as this might be faster to get than `data().len()`
217217
/// for instance for tensors residing in GPU.
@@ -678,7 +678,7 @@ impl View for &TensorView<'_> {
678678
&self.shape
679679
}
680680

681-
fn data(&self) -> Cow<[u8]> {
681+
fn data(&self) -> Cow<'_, [u8]> {
682682
self.data.into()
683683
}
684684

@@ -696,7 +696,7 @@ impl View for TensorView<'_> {
696696
&self.shape
697697
}
698698

699-
fn data(&self) -> Cow<[u8]> {
699+
fn data(&self) -> Cow<'_, [u8]> {
700700
self.data.into()
701701
}
702702

0 commit comments

Comments
 (0)