Skip to content

File tree

5 files changed

+15
-18
lines changed

5 files changed

+15
-18
lines changed
 

‎Cargo.toml

+4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@ edition = "2021"
77
rust-version = "1.74"
88

99
[lints.rust]
10+
unreachable_pub = "warn"
11+
unsafe_code = "warn"
1012
unused_crate_dependencies = "warn"
1113

1214
[lints.clippy]
15+
panic_in_result_fn = "warn"
1316
pedantic = "warn"
17+
unwrap_used = "warn"
1418

1519
[dependencies]
1620
indoc = "2"

‎clippy.toml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
allow-unwrap-in-tests = true

‎src/error.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,13 @@ use indoc::formatdoc;
44
use libherokubuildpack::log::log_error;
55

66
#[derive(Debug)]
7-
// This allow can be removed once the visibility of this enum is fixed,
8-
// since the lint only applies to public APIs.
9-
#[allow(clippy::module_name_repetitions)]
10-
pub enum ProcfileBuildpackError {
7+
pub(crate) enum ProcfileBuildpackError {
118
CannotReadProcfileContents(std::io::Error),
129
ProcfileParsingError(ProcfileParsingError),
1310
ProcfileConversionError(ProcfileConversionError),
1411
}
1512

16-
// This allow can be removed once the visibility of this enum is fixed,
17-
// since the lint only applies to public APIs.
18-
#[allow(clippy::module_name_repetitions)]
19-
pub fn error_handler(buildpack_error: ProcfileBuildpackError) {
13+
pub(crate) fn error_handler(buildpack_error: ProcfileBuildpackError) {
2014
match buildpack_error {
2115
ProcfileBuildpackError::CannotReadProcfileContents(io_error) => {
2216
log_error(

‎src/launch.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl TryFrom<Procfile> for Launch {
3535
}
3636

3737
#[derive(Debug)]
38-
pub enum ProcfileConversionError {
38+
pub(crate) enum ProcfileConversionError {
3939
InvalidProcessType(libcnb::data::launch::ProcessTypeError),
4040
}
4141

‎src/procfile.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,23 @@ use regex::Regex;
33
use std::str::FromStr;
44

55
#[derive(Debug, Eq, PartialEq)]
6-
pub struct Procfile {
7-
pub processes: LinkedHashMap<String, String>,
6+
pub(crate) struct Procfile {
7+
pub(crate) processes: LinkedHashMap<String, String>,
88
}
99

1010
impl Procfile {
11-
pub fn new() -> Self {
11+
pub(crate) fn new() -> Self {
1212
Procfile {
1313
processes: LinkedHashMap::new(),
1414
}
1515
}
1616

17-
pub fn is_empty(&self) -> bool {
17+
pub(crate) fn is_empty(&self) -> bool {
1818
self.processes.is_empty()
1919
}
2020

21-
pub fn insert(&mut self, k: impl Into<String>, v: impl Into<String>) {
21+
#[cfg(test)]
22+
pub(crate) fn insert(&mut self, k: impl Into<String>, v: impl Into<String>) {
2223
self.processes.insert(k.into(), v.into());
2324
}
2425
}
@@ -64,10 +65,7 @@ impl FromStr for Procfile {
6465
// There are currently no ways in which parsing can fail, however we will add some in the future:
6566
// https://github.com/heroku/procfile-cnb/issues/73
6667
#[derive(Debug, Eq, PartialEq)]
67-
// This allow can be removed once the visibility of this enum is fixed,
68-
// since the lint only applies to public APIs.
69-
#[allow(clippy::module_name_repetitions)]
70-
pub enum ProcfileParsingError {}
68+
pub(crate) enum ProcfileParsingError {}
7169

7270
#[cfg(test)]
7371
mod tests {

0 commit comments

Comments
 (0)