Skip to content

Commit 2c8938f

Browse files
committed
fix: run cargo fmt
1 parent ed281f5 commit 2c8938f

File tree

2 files changed

+41
-16
lines changed

2 files changed

+41
-16
lines changed

src/spec_error.rs

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,35 +6,59 @@ use std::fmt::{Debug, Display};
66
pub struct SpecErrorWrapper<E>(pub E);
77

88
pub trait SpecError<E>: Sized {
9-
fn __sqlx_spec_error(&self) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static>;
9+
fn __sqlx_spec_error(
10+
&self,
11+
) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static>;
1012
}
1113

12-
impl<E> SpecError<E> for &&&&SpecErrorWrapper<E> where E: Error + Send + Sync + 'static {
13-
fn __sqlx_spec_error(&self) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
14+
impl<E> SpecError<E> for &&&&SpecErrorWrapper<E>
15+
where
16+
E: Error + Send + Sync + 'static,
17+
{
18+
fn __sqlx_spec_error(
19+
&self,
20+
) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
1421
|e| Box::new(e.0)
1522
}
1623
}
1724

18-
impl<E> SpecError<E> for &&&SpecErrorWrapper<E> where E: Display {
19-
fn __sqlx_spec_error(&self) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
25+
impl<E> SpecError<E> for &&&SpecErrorWrapper<E>
26+
where
27+
E: Display,
28+
{
29+
fn __sqlx_spec_error(
30+
&self,
31+
) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
2032
|e| e.0.to_string().into()
2133
}
2234
}
2335

24-
impl<E> SpecError<E> for &&SpecErrorWrapper<E> where E: Debug {
25-
fn __sqlx_spec_error(&self) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
36+
impl<E> SpecError<E> for &&SpecErrorWrapper<E>
37+
where
38+
E: Debug,
39+
{
40+
fn __sqlx_spec_error(
41+
&self,
42+
) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
2643
|e| format!("{:?}", e.0).into()
2744
}
2845
}
2946

30-
impl<E> SpecError<E> for &SpecErrorWrapper<E> where E: Any {
31-
fn __sqlx_spec_error(&self) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
47+
impl<E> SpecError<E> for &SpecErrorWrapper<E>
48+
where
49+
E: Any,
50+
{
51+
fn __sqlx_spec_error(
52+
&self,
53+
) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
3254
|_e| format!("unprintable error: {}", std::any::type_name::<E>()).into()
3355
}
3456
}
3557

3658
impl<E> SpecError<E> for SpecErrorWrapper<E> {
37-
fn __sqlx_spec_error(&self) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
59+
fn __sqlx_spec_error(
60+
&self,
61+
) -> fn(SpecErrorWrapper<E>) -> Box<dyn Error + Send + Sync + 'static> {
3862
|_e| "unprintable error: (unprintable type)".into()
3963
}
4064
}
@@ -58,7 +82,8 @@ fn test_spec_error() {
5882

5983
struct AnyError;
6084

61-
let _e: Box<dyn Error + Send + Sync + 'static> = __spec_error!(std::io::Error::from(std::io::ErrorKind::Unsupported));
85+
let _e: Box<dyn Error + Send + Sync + 'static> =
86+
__spec_error!(std::io::Error::from(std::io::ErrorKind::Unsupported));
6287

6388
let _e: Box<dyn Error + Send + Sync + 'static> = __spec_error!("displayable error");
6489

@@ -67,4 +92,4 @@ fn test_spec_error() {
6792
let _e: Box<dyn Error + Send + Sync + 'static> = __spec_error!(AnyError);
6893

6994
let _e: Box<dyn Error + Send + Sync + 'static> = __spec_error!(&1i32);
70-
}
95+
}

tests/postgres/derives.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -772,23 +772,23 @@ async fn test_enum_with_schema() -> anyhow::Result<()> {
772772

773773
#[cfg(feature = "macros")]
774774
#[sqlx_macros::test]
775-
async fn test_from_row_hygiene() -> anyhow::Result<()> {
775+
async fn test_from_row_hygiene() -> anyhow::Result<()> {
776776
// A field named `row` previously would shadow the `row` parameter of `FromRow::from_row()`:
777777
// https://github.com/launchbadge/sqlx/issues/3344
778778
#[derive(Debug, sqlx::FromRow)]
779779
pub struct Foo {
780780
pub row: i32,
781-
pub bar: i32
781+
pub bar: i32,
782782
}
783783

784784
let mut conn = new::<Postgres>().await?;
785785

786786
let foo: Foo = sqlx::query_as("SELECT 1234 as row, 5678 as bar")
787787
.fetch_one(&mut conn)
788788
.await?;
789-
789+
790790
assert_eq!(foo.row, 1234);
791791
assert_eq!(foo.bar, 5678);
792792

793793
Ok(())
794-
}
794+
}

0 commit comments

Comments
 (0)