Skip to content

Commit

Permalink
Merge branch 'main' into crate_codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
Virgiel committed Oct 20, 2023
2 parents 65f87ab + 22df44e commit d68b13b
Show file tree
Hide file tree
Showing 19 changed files with 328 additions and 346 deletions.
629 changes: 305 additions & 324 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"examples/*",
"test_integration",
Expand Down
2 changes: 1 addition & 1 deletion benches/generated/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ futures = "0.3.28"

## Async features dependencies
# Async connection pooling
deadpool-postgres = { version = "0.10.5", optional = true }
deadpool-postgres = { version = "0.11.0", optional = true }
2 changes: 1 addition & 1 deletion benches/generated/src/array_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for ArrayIterator<'a, T> {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}
fn accepts(ty: &Type) -> bool {
Expand Down
4 changes: 2 additions & 2 deletions crates/cornucopia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ clap = { version = "4.3.5", features = ["derive"] }
heck = "0.4.1"

# Order-preserving map to work around borrowing issues
indexmap = "2.0.0"
indexmap = "2.0.2"

# Generate temporary files
tempfile = "3.6.0"
tempfile = "3.6.0"
2 changes: 1 addition & 1 deletion crates/cornucopia/src/codegen/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ pub fn gen_cargo_file(
## Async features dependencies
# Async connection pooling
deadpool-postgres = {{ version = "0.10.5", optional = true }}
deadpool-postgres = {{ version = "0.11.0", optional = true }}
"#}
.unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cornucopia/src/codegen/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ pub fn core_array() -> String {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}

Expand Down
3 changes: 2 additions & 1 deletion crates/cornucopia/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ impl Query {
.iter()
.enumerate()
.rev()
.filter_map(|(i, u)| (!bind_params[..i].contains(u)).then(|| u.clone()))
.filter(|(i, u)| !bind_params[..*i].contains(u))
.map(|(_, u)| u.clone())
.rev()
.collect();

Expand Down
2 changes: 1 addition & 1 deletion examples/auto_build/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ futures = "0.3.28"
# Postgres interaction
tokio-postgres = "0.7.8"
# Connection pooling
deadpool-postgres = "0.10.5"
deadpool-postgres = "0.11.0"
2 changes: 1 addition & 1 deletion examples/auto_build/auto_build_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ futures = "0.3.28"

## Async features dependencies
# Async connection pooling
deadpool-postgres = { version = "0.10.5", optional = true }
deadpool-postgres = { version = "0.11.0", optional = true }
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for ArrayIterator<'a, T> {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}
fn accepts(ty: &Type) -> bool {
Expand Down
6 changes: 3 additions & 3 deletions examples/basic_async/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ codegen = { path = "basic_async_codegen", package = "basic_async_codegen" }
tokio = { version = "1.28.1", features = ["macros", "rt-multi-thread"] }
futures = "0.3.28"
# Postgres interaction
tokio-postgres = "0.7.8"
# Connection pooling
deadpool-postgres = "0.10.5"
tokio-postgres = "0.7.7"
## Connection pooling
deadpool-postgres = "0.11.0"
2 changes: 1 addition & 1 deletion examples/basic_async/basic_async_codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ futures = "0.3.28"

## Async features dependencies
# Async connection pooling
deadpool-postgres = { version = "0.10.5", optional = true }
deadpool-postgres = { version = "0.11.0", optional = true }
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for ArrayIterator<'a, T> {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}
fn accepts(ty: &Type) -> bool {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for ArrayIterator<'a, T> {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}
fn accepts(ty: &Type) -> bool {
Expand Down
2 changes: 1 addition & 1 deletion test_codegen/codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ futures = "0.3.28"

## Async features dependencies
# Async connection pooling
deadpool-postgres = { version = "0.10.5", optional = true }
deadpool-postgres = { version = "0.11.0", optional = true }
2 changes: 1 addition & 1 deletion test_codegen/codegen/src/array_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl<'a, T: FromSql<'a>> FromSql<'a> for ArrayIterator<'a, T> {
Ok(ArrayIterator {
ty: member_type.clone(),
values: array.values(),
_type: PhantomData::default(),
_type: PhantomData,
})
}
fn accepts(ty: &Type) -> bool {
Expand Down
5 changes: 2 additions & 3 deletions test_codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ pub fn test_trait_sql(client: &mut Client) {
.unwrap();
find_books().bind(client, &vec![cow]).all().unwrap();

let map: HashMap<&str, &str> =
HashMap::from_iter([("one", "1"), ("two", "2"), ("three", "3")].into_iter());
let map: HashMap<&str, &str> = HashMap::from_iter([("one", "1"), ("two", "2"), ("three", "3")]);

// Old way with allocation
let vec: Vec<_> = map.values().collect();
Expand Down Expand Up @@ -297,7 +296,7 @@ pub fn test_named(client: &mut Client) {
}

// Test we correctly implement borrowed version and copy derive
#[allow(clippy::drop_copy)]
#[allow(dropping_copy_types)]
pub fn test_copy(client: &mut Client) {
// Test copy
let copy_params = CopyComposite {
Expand Down
2 changes: 1 addition & 1 deletion test_integration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ postgres = "0.19.5"
## Test fixtures ser/de
serde = { version = "1.0.163", features = ["derive"] }
## Read/write fixture files
toml = "0.7.3"
toml = "0.8.2"

0 comments on commit d68b13b

Please sign in to comment.