Skip to content

Commit

Permalink
Use some more anonymous lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
kngwyu committed Nov 20, 2020
1 parent 3435014 commit 7d217d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ pub trait FromPyObject<'source>: Sized {

/// Identity conversion: allows using existing `PyObject` instances where
/// `T: ToPyObject` is expected.
impl<'a, T: ?Sized + ToPyObject> ToPyObject for &'a T {
impl<T: ?Sized + ToPyObject> ToPyObject for &'_ T {
#[inline]
fn to_object(&self, py: Python) -> PyObject {
<T as ToPyObject>::to_object(*self, py)
Expand Down
8 changes: 4 additions & 4 deletions src/types/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,16 @@ impl<'source> FromPyObject<'source> for &'source str {

/// Allows extracting strings from Python objects.
/// Accepts Python `str` and `unicode` objects.
impl<'source> FromPyObject<'source> for String {
fn extract(obj: &'source PyAny) -> PyResult<Self> {
impl FromPyObject<'_> for String {
fn extract(obj: &PyAny) -> PyResult<Self> {
<PyString as PyTryFrom>::try_from(obj)?
.to_str()
.map(ToOwned::to_owned)
}
}

impl<'source> FromPyObject<'source> for char {
fn extract(obj: &'source PyAny) -> PyResult<Self> {
impl FromPyObject<'_> for char {
fn extract(obj: &PyAny) -> PyResult<Self> {
let s = PyString::try_from(obj)?.to_str()?;
let mut iter = s.chars();
if let (Some(ch), None) = (iter.next(), iter.next()) {
Expand Down

0 comments on commit 7d217d2

Please sign in to comment.