diff --git a/src/home_assistant/home_assistant.rs b/src/home_assistant/home_assistant.rs index 90f98ed..64901ed 100644 --- a/src/home_assistant/home_assistant.rs +++ b/src/home_assistant/home_assistant.rs @@ -19,25 +19,25 @@ impl<'source> FromPyObject<'source> for HomeAssistant { impl HomeAssistant { /// Return the representation - pub fn repr(&self, py: &Python) -> Result { - let bound = self.0.bind(*py); + pub fn repr(&self, py: Python<'_>) -> Result { + let bound = self.0.bind(py); let repr = bound.repr()?; repr.extract() } /// Return if Home Assistant is running. - pub fn is_running(&self, py: &Python) -> Result { - let is_running = self.0.getattr(*py, "is_running")?; - is_running.extract(*py) + pub fn is_running(&self, py: Python<'_>) -> Result { + let is_running = self.0.getattr(py, "is_running")?; + is_running.extract(py) } /// Return if Home Assistant is stopping. - pub fn is_stopping(&self, py: &Python) -> Result { - let is_stopping = self.0.getattr(*py, "is_stopping")?; - is_stopping.extract(*py) + pub fn is_stopping(&self, py: Python<'_>) -> Result { + let is_stopping = self.0.getattr(py, "is_stopping")?; + is_stopping.extract(py) } - pub fn states(&self, py: &Python) -> Result { - let states = self.0.getattr(*py, "states")?; - states.extract(*py) + pub fn states(&self, py: Python<'_>) -> Result { + let states = self.0.getattr(py, "states")?; + states.extract(py) } } diff --git a/src/home_assistant/state_machine.rs b/src/home_assistant/state_machine.rs index 77adf58..3f2e80b 100644 --- a/src/home_assistant/state_machine.rs +++ b/src/home_assistant/state_machine.rs @@ -23,11 +23,11 @@ impl<'py> FromPyObject<'py> for StateMachine { impl StateMachine { pub fn get FromPyObject<'py>, ContextEvent: for<'py> FromPyObject<'py>>( &self, - py: &Python, + py: Python<'_>, entity_id: EntityId, - ) -> Result>, PyErr> { + ) -> PyResult>> { let args = (entity_id.to_string(),); - let state = self.0.call_method1(*py, "get", args)?; - state.extract(*py) + let state = self.0.call_method1(py, "get", args)?; + state.extract(py) } } diff --git a/src/lib.rs b/src/lib.rs index 39f3769..c57b6b8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,7 +47,7 @@ async fn real_main(home_assistant: HomeAssistant) -> ! { } #[pyfunction] -fn main<'p>(py: Python<'p>, home_assistant: HomeAssistant) -> PyResult> { +fn main<'py>(py: Python<'py>, home_assistant: HomeAssistant) -> PyResult> { pyo3_async_runtimes::tokio::future_into_py::<_, ()>(py, async { real_main(home_assistant).await; })