From 4804e6b15f114fad82670464b9a41701bd28f2f3 Mon Sep 17 00:00:00 2001 From: Tobias Bieniek Date: Fri, 18 Oct 2024 09:19:07 +0000 Subject: [PATCH] models/team: Replace `String` with `&str` for `NewTeam` struct fields --- src/models/team.rs | 12 ++++++------ src/typosquat/test_util.rs | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/models/team.rs b/src/models/team.rs index bb9a0f63a02..89804ffa874 100644 --- a/src/models/team.rs +++ b/src/models/team.rs @@ -39,8 +39,8 @@ pub struct Team { pub struct NewTeam<'a> { pub login: &'a str, pub github_id: i32, - pub name: Option, - pub avatar: Option, + pub name: Option<&'a str>, + pub avatar: Option<&'a str>, pub org_id: i32, } @@ -49,8 +49,8 @@ impl<'a> NewTeam<'a> { login: &'a str, org_id: i32, github_id: i32, - name: Option, - avatar: Option, + name: Option<&'a str>, + avatar: Option<&'a str>, ) -> Self { NewTeam { login, @@ -174,8 +174,8 @@ impl Team { &login.to_lowercase(), org_id, team.id, - team.name, - org.avatar_url, + team.name.as_deref(), + org.avatar_url.as_deref(), ) .create_or_update(conn) .map_err(Into::into) diff --git a/src/typosquat/test_util.rs b/src/typosquat/test_util.rs index 19b93d4d8df..c1eb58cf59a 100644 --- a/src/typosquat/test_util.rs +++ b/src/typosquat/test_util.rs @@ -68,7 +68,7 @@ pub mod faker { &format!("github:{org}:{team}"), next_gh_id(), next_gh_id(), - Some(team.to_string()), + Some(team), None, ) .create_or_update(conn)?,