Skip to content

Commit b64a56d

Browse files
committed
&String to &str
1 parent 911256e commit b64a56d

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/db/jobs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use tokio_postgres::Client as DbClient;
77
use uuid::Uuid;
88

99
pub struct JobSchedule {
10-
pub name: String,
10+
pub name: &'static str,
1111
pub schedule: Schedule,
1212
pub metadata: serde_json::Value,
1313
}
@@ -24,7 +24,7 @@ pub struct Job {
2424

2525
pub async fn insert_job(
2626
db: &DbClient,
27-
name: &String,
27+
name: &str,
2828
scheduled_at: &DateTime<Utc>,
2929
metadata: &serde_json::Value,
3030
) -> Result<()> {
@@ -76,7 +76,7 @@ pub async fn update_job_executed_at(db: &DbClient, id: &Uuid) -> Result<()> {
7676

7777
pub async fn get_job_by_name_and_scheduled_at(
7878
db: &DbClient,
79-
name: &String,
79+
name: &str,
8080
scheduled_at: &DateTime<Utc>,
8181
) -> Result<Job> {
8282
tracing::trace!(

src/handlers/docs_update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const TITLE: &str = "Update books";
3030

3131
pub fn job() -> JobSchedule {
3232
JobSchedule {
33-
name: "docs_update".to_string(),
33+
name: "docs_update",
3434
// Around 9am Pacific time on every Monday.
3535
schedule: Schedule::from_str("0 00 17 * * Mon *").unwrap(),
3636
metadata: serde_json::Value::Null,

src/handlers/jobs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ use super::Context;
88

99
pub async fn handle_job(
1010
ctx: &Context,
11-
name: &String,
11+
name: &str,
1212
metadata: &serde_json::Value,
1313
) -> anyhow::Result<()> {
14-
match name.as_str() {
14+
match name {
1515
"docs_update" => super::docs_update::handle_job().await,
1616
"rustc_commits" => {
1717
super::rustc_commits::synchronize_commits_inner(ctx, None).await;
1818
Ok(())
1919
}
20-
_ => default(&name, &metadata),
20+
_ => default(name, &metadata),
2121
}
2222
}
2323

24-
fn default(name: &String, metadata: &serde_json::Value) -> anyhow::Result<()> {
24+
fn default(name: &str, metadata: &serde_json::Value) -> anyhow::Result<()> {
2525
tracing::trace!(
2626
"handle_job fell into default case: (name={:?}, metadata={:?})",
2727
name,

src/handlers/rustc_commits.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub async fn synchronize_commits_inner(ctx: &Context, starter: Option<(String, u
155155

156156
pub fn job() -> JobSchedule {
157157
JobSchedule {
158-
name: "rustc_commits".to_string(),
158+
name: "rustc_commits",
159159
// Every 30 minutes...
160160
schedule: Schedule::from_str("* 0,30 * * * * *").unwrap(),
161161
metadata: serde_json::Value::Null,

0 commit comments

Comments
 (0)