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 2
2
#![ forbid( clippy:: allow_attributes) ]
3
3
#![ deny( clippy:: pedantic) ]
4
4
5
+ use crate :: models:: { NewPost , Post } ;
5
6
use diesel:: r2d2:: { ConnectionManager , Pool } ;
6
- use diesel:: PgConnection ;
7
+ use diesel:: { PgConnection , RunQueryDsl , SelectableHelper } ;
7
8
use diesel_migrations:: { embed_migrations, EmbeddedMigrations , MigrationHarness } ;
8
9
use postgresql_embedded:: { PostgreSQL , Result , Settings , VersionReq } ;
10
+
9
11
mod models;
10
12
pub mod schema;
11
13
12
- use self :: models:: * ;
13
- use diesel:: prelude:: * ;
14
-
15
14
const MIGRATIONS : EmbeddedMigrations = embed_migrations ! ( "./migrations/" ) ;
16
15
#[ tokio:: main]
17
16
async fn main ( ) -> Result < ( ) > {
@@ -52,6 +51,10 @@ async fn main() -> Result<()> {
52
51
postgresql. stop ( ) . await
53
52
}
54
53
54
+ /// Create a new post
55
+ ///
56
+ /// # Panics
57
+ /// if the post cannot be saved
55
58
pub fn create_post ( conn : & mut PgConnection , title : & str , body : & str ) -> Post {
56
59
use crate :: schema:: posts;
57
60
Original file line number Diff line number Diff line change @@ -135,7 +135,6 @@ impl Settings {
135
135
/// # Errors
136
136
///
137
137
/// Returns an error if the URL is invalid.
138
- #[ expect( irrefutable_let_patterns) ]
139
138
pub fn from_url < S : AsRef < str > > ( url : S ) -> Result < Self > {
140
139
let parsed_url = match Url :: parse ( url. as_ref ( ) ) {
141
140
Ok ( parsed_url) => parsed_url,
You can’t perform that action at this time.
0 commit comments