Skip to content

Commit f118be8

Browse files
authored
Merge pull request #1960 from Urgau/warn-unreachable_pub
Apply `unreachable_pub` lint suggestions to our repository
2 parents 4d54d43 + 300355a commit f118be8

File tree

9 files changed

+21
-20
lines changed

9 files changed

+21
-20
lines changed

src/handlers/assign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ fn get_team_name<'a>(teams: &Teams, issue: &Issue, name: &'a str) -> Option<&'a
596596
}
597597

598598
#[derive(PartialEq, Debug)]
599-
pub enum FindReviewerError {
599+
enum FindReviewerError {
600600
/// User specified something like `r? foo/bar` where that team name could
601601
/// not be found.
602602
TeamNotFound(String),

src/handlers/check_commits/behind_upstream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::github::{GithubClient, GithubCommit, IssuesEvent, Repository};
22
use tracing as log;
33

44
/// Default threshold for parent commit age in days to trigger a warning
5-
pub const DEFAULT_DAYS_THRESHOLD: usize = 7;
5+
pub(super) const DEFAULT_DAYS_THRESHOLD: usize = 7;
66

77
/// Check if the PR is based on an old parent commit
8-
pub async fn behind_upstream(
8+
pub(super) async fn behind_upstream(
99
age_threshold: usize,
1010
event: &IssuesEvent,
1111
client: &GithubClient,
@@ -64,7 +64,7 @@ pub async fn behind_upstream(
6464
/// - If there is no parent commit
6565
/// - If parent is within threshold
6666
/// - Err(...) - If an error occurred during processing
67-
pub async fn is_parent_commit_too_old(
67+
pub(super) async fn is_parent_commit_too_old(
6868
commit: &GithubCommit,
6969
repo: &Repository,
7070
client: &GithubClient,
@@ -85,7 +85,7 @@ pub async fn is_parent_commit_too_old(
8585
}
8686

8787
/// Returns the number of days old the commit is
88-
pub async fn commit_days_old(
88+
pub(super) async fn commit_days_old(
8989
sha: &str,
9090
repo: &Repository,
9191
client: &GithubClient,

src/handlers/major_change.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use parser::command::second::SecondCommand;
99
use tracing as log;
1010

1111
#[derive(Clone, PartialEq, Eq, Debug)]
12-
pub enum Invocation {
12+
pub(super) enum Invocation {
1313
NewProposal,
1414
AcceptedProposal,
1515
Rename { prev_issue: ZulipGitHubReference },

src/handlers/milestone_prs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use regex::Regex;
77
use reqwest::StatusCode;
88
use tracing as log;
99

10-
pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
10+
pub(super) async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
1111
let e = if let Event::Issue(e) = event {
1212
e
1313
} else {

src/handlers/note.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct NoteDataEntry {
4848
}
4949

5050
impl NoteDataEntry {
51-
pub fn to_markdown(&self) -> String {
51+
pub(crate) fn to_markdown(&self) -> String {
5252
format!(
5353
"\n- [\"{title}\" by @{author}]({comment_url})",
5454
title = self.title,
@@ -74,7 +74,7 @@ struct NoteData {
7474
}
7575

7676
impl NoteData {
77-
pub fn get_url_from_title(&self, title: &str) -> Option<String> {
77+
pub(crate) fn get_url_from_title(&self, title: &str) -> Option<String> {
7878
let tmp = self.entries_by_url.clone();
7979
tmp.iter().sorted().find_map(|(key, val)| {
8080
if val.title == title {
@@ -85,7 +85,7 @@ impl NoteData {
8585
})
8686
}
8787

88-
pub fn remove_by_title(&mut self, title: &str) -> Option<NoteDataEntry> {
88+
pub(crate) fn remove_by_title(&mut self, title: &str) -> Option<NoteDataEntry> {
8989
if let Some(url_to_remove) = self.get_url_from_title(title) {
9090
if let Some(entry) = self.entries_by_url.remove(&url_to_remove) {
9191
log::debug!("SUCCESSFULLY REMOVED ENTRY: {:#?}", &entry);
@@ -100,7 +100,7 @@ impl NoteData {
100100
}
101101
}
102102

103-
pub fn to_markdown(&self) -> String {
103+
pub(crate) fn to_markdown(&self) -> String {
104104
if self.entries_by_url.is_empty() {
105105
return String::new();
106106
}

src/handlers/notification.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use anyhow::Context as _;
1414
use std::collections::HashSet;
1515
use tracing as log;
1616

17-
pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
17+
pub(super) async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
1818
let body = match event.comment_body() {
1919
Some(v) => v,
2020
// Skip events that don't have comment bodies associated

src/handlers/relnotes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct RelnotesState {
2929

3030
const TITLE_PREFIX: &str = "Tracking issue for release notes";
3131

32-
pub async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
32+
pub(super) async fn handle(ctx: &Context, event: &Event) -> anyhow::Result<()> {
3333
let Event::Issue(e) = event else {
3434
return Ok(());
3535
};

src/handlers/rendered_link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::{
88
handlers::Context,
99
};
1010

11-
pub async fn handle(
11+
pub(super) async fn handle(
1212
ctx: &Context,
1313
event: &Event,
1414
config: &RenderedLinkConfig,

src/tests/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ use tokio::sync::RwLock;
1010
use tokio_postgres::config::Host;
1111
use tokio_postgres::{Config, GenericClient};
1212

13-
pub mod github;
13+
pub(crate) mod github;
1414

1515
/// Represents a connection to a Postgres database that can be
1616
/// used in integration tests to test logic that interacts with
1717
/// a database.
18-
pub struct TestContext {
18+
pub(crate) struct TestContext {
1919
pool: ClientPool,
2020
ctx: Context,
2121
db_name: String,
@@ -83,15 +83,16 @@ impl TestContext {
8383
/// Returns a fake handler context.
8484
/// We currently do not mock outgoing nor incoming GitHub API calls,
8585
/// so the API endpoints will not be actually working.
86-
pub fn handler_ctx(&self) -> &Context {
86+
pub(crate) fn handler_ctx(&self) -> &Context {
8787
&self.ctx
8888
}
8989

90-
pub async fn db_client(&self) -> PooledClient {
90+
pub(crate) async fn db_client(&self) -> PooledClient {
9191
self.pool.get().await
9292
}
9393

94-
pub async fn add_user(&self, name: &str, id: u64) {
94+
#[allow(dead_code)]
95+
pub(crate) async fn add_user(&self, name: &str, id: u64) {
9596
record_username(self.db_client().await.client(), id, name)
9697
.await
9798
.expect("Cannot create user");
@@ -113,7 +114,7 @@ impl TestContext {
113114
}
114115
}
115116

116-
pub async fn run_test<F, Fut>(f: F)
117+
pub(crate) async fn run_test<F, Fut>(f: F)
117118
where
118119
F: FnOnce(TestContext) -> Fut,
119120
Fut: Future<Output = anyhow::Result<TestContext>>,

0 commit comments

Comments
 (0)