Skip to content

update clippy linting #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
msrv = "1.60.0"
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ jobs:
continue-on-error: ${{ matrix.required }}
strategy:
matrix:
build: [stable, nightly]
build: [stable, nightly, msrv]
include:
- build: stable
required: true
toolchain: stable
- build: nightly
required: false
toolchain: nightly
- build: msrv
required: true
toolchain: "1.60.0"

services:
postgres:
Expand Down Expand Up @@ -47,7 +50,6 @@ jobs:
profile: minimal
toolchain: ${{ matrix.toolchain }}
override: true
components: rustfmt

- name: Rust cache
uses: Swatinem/rust-cache@v2
Expand Down Expand Up @@ -163,4 +165,4 @@ jobs:
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
args: --all-features --all --all-targets
3 changes: 1 addition & 2 deletions eventually-postgres/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ pub enum SaveError {
impl From<SaveError> for Option<version::ConflictError> {
fn from(err: SaveError) -> Self {
match err {
SaveError::Conflict(v) => Some(v),
SaveError::Concurrency(v) => Some(v),
SaveError::Conflict(v) | SaveError::Concurrency(v) => Some(v),
_ => None,
}
}
Expand Down
20 changes: 7 additions & 13 deletions eventually-postgres/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,7 @@ use eventually::{
version::Version,
};
use futures::{future::ready, StreamExt, TryStreamExt};
use lazy_static::lazy_static;
use regex::Regex;
use sqlx::{
postgres::{PgDatabaseError, PgRow},
PgPool, Postgres, Row, Transaction,
};
use sqlx::{postgres::PgRow, PgPool, Postgres, Row, Transaction};

#[derive(Debug, thiserror::Error)]
pub enum StreamError {
Expand Down Expand Up @@ -54,8 +49,7 @@ pub enum AppendError {
impl From<AppendError> for Option<version::ConflictError> {
fn from(err: AppendError) -> Self {
match err {
AppendError::Conflict(v) => Some(v),
AppendError::Concurrency(v) => Some(v),
AppendError::Conflict(v) | AppendError::Concurrency(v) => Some(v),
_ => None,
}
}
Expand Down Expand Up @@ -184,11 +178,11 @@ where
fn event_row_to_persisted_event(
&self,
stream_id: Id,
row: PgRow,
row: &PgRow,
) -> Result<event::Persisted<Id, Evt>, StreamError> {
let version_column: i32 = try_get_column(&row, "version")?;
let event_column: Vec<u8> = try_get_column(&row, "event")?;
let metadata_column: sqlx::types::Json<Metadata> = try_get_column(&row, "metadata")?;
let version_column: i32 = try_get_column(row, "version")?;
let event_column: Vec<u8> = try_get_column(row, "event")?;
let metadata_column: sqlx::types::Json<Metadata> = try_get_column(row, "metadata")?;

let deserialized_event = self
.serde
Expand Down Expand Up @@ -240,7 +234,7 @@ where
.bind(from_version)
.fetch(&self.pool)
.map_err(StreamError::Database)
.and_then(move |row| ready(self.event_row_to_persisted_event(id.clone(), row)))
.and_then(move |row| ready(self.event_row_to_persisted_event(id.clone(), &row)))
.boxed()
}
}
Expand Down
4 changes: 1 addition & 3 deletions eventually/src/aggregate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,7 @@ pub(crate) mod test_user_domain {
return Err(UserError::EmptyPassword);
}

Ok(Self::record_new(
UserEvent::WasCreated { email, password }.into(),
)?)
Self::record_new(UserEvent::WasCreated { email, password }.into())
}

pub(crate) fn change_password(&mut self, password: String) -> Result<(), UserError> {
Expand Down