Merge pull request #3798 from davidhewitt/beta-map-clone
ci: fix beta clippy `map_clone` warning
This commit is contained in:
commit
7938d4cadc
|
@ -1443,6 +1443,9 @@ where
|
||||||
{
|
{
|
||||||
/// Extracts `Self` from the source `PyObject`.
|
/// Extracts `Self` from the source `PyObject`.
|
||||||
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
|
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
|
||||||
|
// TODO update MSRV past 1.59 and use .cloned() to make
|
||||||
|
// clippy happy
|
||||||
|
#[allow(clippy::map_clone)]
|
||||||
ob.downcast().map(Clone::clone).map_err(Into::into)
|
ob.downcast().map(Clone::clone).map_err(Into::into)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,13 +264,13 @@ impl Sequence {
|
||||||
self.values.len()
|
self.values.len()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn __getitem__(&self, index: SequenceIndex<'_>) -> PyResult<PyObject> {
|
fn __getitem__(&self, index: SequenceIndex<'_>, py: Python<'_>) -> PyResult<PyObject> {
|
||||||
match index {
|
match index {
|
||||||
SequenceIndex::Integer(index) => {
|
SequenceIndex::Integer(index) => {
|
||||||
let uindex = self.usize_index(index)?;
|
let uindex = self.usize_index(index)?;
|
||||||
self.values
|
self.values
|
||||||
.get(uindex)
|
.get(uindex)
|
||||||
.map(Clone::clone)
|
.map(|o| o.clone_ref(py))
|
||||||
.ok_or_else(|| PyIndexError::new_err(index))
|
.ok_or_else(|| PyIndexError::new_err(index))
|
||||||
}
|
}
|
||||||
// Just to prove that slicing can be implemented
|
// Just to prove that slicing can be implemented
|
||||||
|
|
Loading…
Reference in New Issue