Skip to content

Commit 88b9725

Browse files
committed
Fix the last of the clippy warnings
1 parent 22daf92 commit 88b9725

File tree

3 files changed

+11
-27
lines changed

3 files changed

+11
-27
lines changed

Diff for: lib/src/github/models.rs

+9-27
Original file line numberDiff line numberDiff line change
@@ -56,24 +56,15 @@ impl HookBody {
5656
}
5757

5858
pub fn ref_name(&self) -> &str {
59-
match self.ref_name {
60-
Some(ref v) => v,
61-
None => "",
62-
}
59+
self.ref_name.as_deref().unwrap_or_default()
6360
}
6461

6562
pub fn after(&self) -> &str {
66-
match self.after {
67-
Some(ref v) => v,
68-
None => "",
69-
}
63+
self.after.as_deref().unwrap_or_default()
7064
}
7165

7266
pub fn before(&self) -> &str {
73-
match self.before {
74-
Some(ref v) => v,
75-
None => "",
76-
}
67+
self.before.as_deref().unwrap_or_default()
7768
}
7869

7970
pub fn forced(&self) -> bool {
@@ -134,13 +125,10 @@ impl User {
134125
}
135126

136127
pub fn login(&self) -> &str {
137-
if let Some(ref login) = self.login {
138-
login
139-
} else if let Some(ref name) = self.name {
140-
name
141-
} else {
142-
""
143-
}
128+
self.login
129+
.as_deref()
130+
.or(self.name.as_deref())
131+
.unwrap_or_default()
144132
}
145133
}
146134

@@ -416,10 +404,7 @@ impl Review {
416404

417405
impl CommentLike for &Review {
418406
fn body(&self) -> &str {
419-
match self.body {
420-
Some(ref body) => body,
421-
None => "",
422-
}
407+
self.body.as_deref().unwrap_or_default()
423408
}
424409

425410
fn user(&self) -> &User {
@@ -442,10 +427,7 @@ pub struct Comment {
442427

443428
impl CommentLike for &Comment {
444429
fn body(&self) -> &str {
445-
match self.body {
446-
Some(ref body) => body,
447-
None => "",
448-
}
430+
self.body.as_deref().unwrap_or_default()
449431
}
450432

451433
fn user(&self) -> &User {

Diff for: octobot/tests/mocks/mock_github.rs

+1
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ impl MockGithub {
566566
));
567567
}
568568

569+
#[allow(clippy::too_many_arguments)]
569570
pub fn mock_create_pull_request(
570571
&self,
571572
owner: &str,

Diff for: octobot/tests/mocks/mock_jira.rs

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ pub struct MockJira {
1818
reorder_version_calls: Mutex<Vec<MockCall<()>>>,
1919
add_pending_version_calls: Mutex<Vec<MockCall<()>>>,
2020
remove_pending_versions_calls: Mutex<Vec<MockCall<()>>>,
21+
#[allow(clippy::type_complexity)]
2122
find_pending_versions_calls: Mutex<Vec<MockCall<HashMap<String, Vec<version::Version>>>>>,
2223
}
2324

0 commit comments

Comments
 (0)