Skip to content

Commit 4804e6b

Browse files
committed
models/team: Replace String with &str for NewTeam struct fields
1 parent ac7b0c0 commit 4804e6b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/models/team.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub struct Team {
3939
pub struct NewTeam<'a> {
4040
pub login: &'a str,
4141
pub github_id: i32,
42-
pub name: Option<String>,
43-
pub avatar: Option<String>,
42+
pub name: Option<&'a str>,
43+
pub avatar: Option<&'a str>,
4444
pub org_id: i32,
4545
}
4646

@@ -49,8 +49,8 @@ impl<'a> NewTeam<'a> {
4949
login: &'a str,
5050
org_id: i32,
5151
github_id: i32,
52-
name: Option<String>,
53-
avatar: Option<String>,
52+
name: Option<&'a str>,
53+
avatar: Option<&'a str>,
5454
) -> Self {
5555
NewTeam {
5656
login,
@@ -174,8 +174,8 @@ impl Team {
174174
&login.to_lowercase(),
175175
org_id,
176176
team.id,
177-
team.name,
178-
org.avatar_url,
177+
team.name.as_deref(),
178+
org.avatar_url.as_deref(),
179179
)
180180
.create_or_update(conn)
181181
.map_err(Into::into)

src/typosquat/test_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pub mod faker {
6868
&format!("github:{org}:{team}"),
6969
next_gh_id(),
7070
next_gh_id(),
71-
Some(team.to_string()),
71+
Some(team),
7272
None,
7373
)
7474
.create_or_update(conn)?,

0 commit comments

Comments
 (0)