Skip to content

Commit 120625a

Browse files
remove ::new()
1 parent afc93e4 commit 120625a

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

crates/pg_completions/src/context.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ mod tests {
266266
position: (position as u32).into(),
267267
text,
268268
tree: Some(&tree),
269-
schema: &pg_schema_cache::SchemaCache::new(),
269+
schema: &pg_schema_cache::SchemaCache::default(),
270270
};
271271

272272
let ctx = CompletionContext::new(&params);
@@ -298,7 +298,7 @@ mod tests {
298298
position: (position as u32).into(),
299299
text,
300300
tree: Some(&tree),
301-
schema: &pg_schema_cache::SchemaCache::new(),
301+
schema: &pg_schema_cache::SchemaCache::default(),
302302
};
303303

304304
let ctx = CompletionContext::new(&params);
@@ -332,7 +332,7 @@ mod tests {
332332
position: (position as u32).into(),
333333
text,
334334
tree: Some(&tree),
335-
schema: &pg_schema_cache::SchemaCache::new(),
335+
schema: &pg_schema_cache::SchemaCache::default(),
336336
};
337337

338338
let ctx = CompletionContext::new(&params);
@@ -357,7 +357,7 @@ mod tests {
357357
position: (position as u32).into(),
358358
text,
359359
tree: Some(&tree),
360-
schema: &pg_schema_cache::SchemaCache::new(),
360+
schema: &pg_schema_cache::SchemaCache::default(),
361361
};
362362

363363
let ctx = CompletionContext::new(&params);
@@ -385,7 +385,7 @@ mod tests {
385385
position: (position as u32).into(),
386386
text,
387387
tree: Some(&tree),
388-
schema: &pg_schema_cache::SchemaCache::new(),
388+
schema: &pg_schema_cache::SchemaCache::default(),
389389
};
390390

391391
let ctx = CompletionContext::new(&params);
@@ -411,7 +411,7 @@ mod tests {
411411
position: (position as u32).into(),
412412
text,
413413
tree: Some(&tree),
414-
schema: &pg_schema_cache::SchemaCache::new(),
414+
schema: &pg_schema_cache::SchemaCache::default(),
415415
};
416416

417417
let ctx = CompletionContext::new(&params);
@@ -436,7 +436,7 @@ mod tests {
436436
position: (position as u32).into(),
437437
text,
438438
tree: Some(&tree),
439-
schema: &pg_schema_cache::SchemaCache::new(),
439+
schema: &pg_schema_cache::SchemaCache::default(),
440440
};
441441

442442
let ctx = CompletionContext::new(&params);

crates/pg_configuration/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ impl PartialConfiguration {
104104
username: Some("postgres".to_string()),
105105
password: Some("postgres".to_string()),
106106
database: Some("postgres".to_string()),
107+
conn_timeout_secs: Some(10),
107108
}),
108109
}
109110
}

crates/pg_schema_cache/src/schema_cache.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ pub struct SchemaCache {
1818
}
1919

2020
impl SchemaCache {
21-
pub fn new() -> SchemaCache {
22-
SchemaCache::default()
23-
}
24-
2521
pub async fn load(pool: &PgPool) -> Result<SchemaCache, sqlx::Error> {
2622
let (schemas, tables, functions, types, versions, columns) = futures_util::try_join!(
2723
Schema::load(pool),

crates/pg_workspace/src/settings.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub struct DatabaseSettings {
267267
pub username: String,
268268
pub password: String,
269269
pub database: String,
270-
pub conn_timeout: Duration,
270+
pub conn_timeout_secs: Duration,
271271
}
272272

273273
impl Default for DatabaseSettings {
@@ -278,7 +278,7 @@ impl Default for DatabaseSettings {
278278
username: "postgres".to_string(),
279279
password: "postgres".to_string(),
280280
database: "postgres".to_string(),
281-
conn_timeout: Duration::from_secs(10),
281+
conn_timeout_secs: Duration::from_secs(10),
282282
}
283283
}
284284
}
@@ -292,7 +292,10 @@ impl From<PartialDatabaseConfiguration> for DatabaseSettings {
292292
username: value.username.unwrap_or(d.username),
293293
password: value.password.unwrap_or(d.password),
294294
database: value.database.unwrap_or(d.database),
295-
conn_timeout: value.conn_timeout.unwrap_or(d.conn_timeout),
295+
conn_timeout_secs: value
296+
.conn_timeout_secs
297+
.map(|s| Duration::from_secs(s.into()))
298+
.unwrap_or(d.conn_timeout_secs),
296299
}
297300
}
298301
}

crates/pg_workspace/src/workspace/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl DbConnection {
6464
.password(&settings.password)
6565
.database(&settings.database);
6666

67-
let timeout = settings.conn_timeout.clone();
67+
let timeout = settings.conn_timeout_secs.clone();
6868

6969
let maybe_pool = run_async(async move {
7070
PoolOptions::<Postgres>::new()

0 commit comments

Comments
 (0)