File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed
examples/diesel_embedded/src Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 22#![ forbid( clippy:: allow_attributes) ]
33#![ deny( clippy:: pedantic) ]
44
5+ use crate :: models:: { NewPost , Post } ;
56use diesel:: r2d2:: { ConnectionManager , Pool } ;
6- use diesel:: PgConnection ;
7+ use diesel:: { PgConnection , RunQueryDsl , SelectableHelper } ;
78use diesel_migrations:: { embed_migrations, EmbeddedMigrations , MigrationHarness } ;
89use postgresql_embedded:: { PostgreSQL , Result , Settings , VersionReq } ;
10+
911mod models;
1012pub mod schema;
1113
12- use self :: models:: * ;
13- use diesel:: prelude:: * ;
14-
1514const MIGRATIONS : EmbeddedMigrations = embed_migrations ! ( "./migrations/" ) ;
1615#[ tokio:: main]
1716async fn main ( ) -> Result < ( ) > {
@@ -52,6 +51,10 @@ async fn main() -> Result<()> {
5251 postgresql. stop ( ) . await
5352}
5453
54+ /// Create a new post
55+ ///
56+ /// # Panics
57+ /// if the post cannot be saved
5558pub fn create_post ( conn : & mut PgConnection , title : & str , body : & str ) -> Post {
5659 use crate :: schema:: posts;
5760
Original file line number Diff line number Diff line change @@ -135,7 +135,6 @@ impl Settings {
135135 /// # Errors
136136 ///
137137 /// Returns an error if the URL is invalid.
138- #[ expect( irrefutable_let_patterns) ]
139138 pub fn from_url < S : AsRef < str > > ( url : S ) -> Result < Self > {
140139 let parsed_url = match Url :: parse ( url. as_ref ( ) ) {
141140 Ok ( parsed_url) => parsed_url,
You can’t perform that action at this time.
0 commit comments