Skip to content

Commit

Permalink
Clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
stefan-k committed Mar 21, 2023
1 parent 2047341 commit 228ef6e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions pyauditor/src/blocking_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ pub struct AuditorClientBlocking {
impl AuditorClientBlocking {
/// health_check()
/// Returns ``true`` if the Auditor instance is healthy, ``false`` otherwise
fn health_check<'a>(self_: PyRef<'a, Self>) -> bool {
fn health_check(self_: PyRef<'_, Self>) -> bool {
self_.inner.health_check()
}

/// get()
/// Gets all records from the Auditors database
fn get<'a>(self_: PyRef<'a, Self>) -> PyResult<Vec<Record>> {
fn get(self_: PyRef<'_, Self>) -> PyResult<Vec<Record>> {
Ok(self_
.inner
.get()
Expand Down Expand Up @@ -64,10 +64,7 @@ impl AuditorClientBlocking {
///
/// records = client.get_stopped_since(start_since)
///
fn get_started_since<'a>(
self_: PyRef<'a, Self>,
timestamp: &PyDateTime,
) -> PyResult<Vec<Record>> {
fn get_started_since(self_: PyRef<'_, Self>, timestamp: &PyDateTime) -> PyResult<Vec<Record>> {
let timestamp: NaiveDateTime = timestamp.extract()?;
let timestamp = Utc.from_utc_datetime(&timestamp.into());
Ok(self_
Expand Down Expand Up @@ -103,10 +100,7 @@ impl AuditorClientBlocking {
///
/// records = client.get_stopped_since(stop_since)
///
fn get_stopped_since<'a>(
self_: PyRef<'a, Self>,
timestamp: &PyDateTime,
) -> PyResult<Vec<Record>> {
fn get_stopped_since(self_: PyRef<'_, Self>, timestamp: &PyDateTime) -> PyResult<Vec<Record>> {
let timestamp: NaiveDateTime = timestamp.extract()?;
let timestamp = Utc.from_utc_datetime(&timestamp.into());
Ok(self_
Expand All @@ -120,15 +114,15 @@ impl AuditorClientBlocking {

/// add(record: Record)
/// Push a record to the Auditor instance
fn add<'a>(&self, record: Record) -> PyResult<()> {
fn add(&self, record: Record) -> PyResult<()> {
self.inner
.add(&auditor::domain::RecordAdd::try_from(record.inner)?)
.map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(format!("{e}")))
}

/// update(record: Record)
/// Update an existing record in the Auditor instance
fn update<'a>(&self, record: Record) -> PyResult<()> {
fn update(&self, record: Record) -> PyResult<()> {
self.inner
.update(&auditor::domain::RecordUpdate::try_from(record.inner)?)
.map_err(|e| pyo3::exceptions::PyRuntimeError::new_err(format!("{e}")))
Expand Down

0 comments on commit 228ef6e

Please sign in to comment.