Skip to content

Commit

Permalink
Fix clippy lints (#310)
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems authored Jul 30, 2024
1 parent f6a5be3 commit a69f101
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ unused_crate_dependencies = "warn"

[workspace.lints.clippy]
panic_in_result_fn = "warn"
pedantic = "warn"
# The explicit priority is required due to https://github.com/rust-lang/cargo/issues/13565.
pedantic = { level = "warn", priority = -1 }
unwrap_used = "warn"
module_name_repetitions = "allow"
10 changes: 5 additions & 5 deletions commons/src/cache/app_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ impl AppCache {
/// # Errors
///
/// - If the cache or applications directory cannot be created
/// (possibly due to permissions error).
/// (possibly due to permissions error).
/// - If files from the cache cannot be loaded into the
/// application directory (possibly due to permissions error).
/// application directory (possibly due to permissions error).
/// - Internal errors from libcnb layer creation and execution.
pub fn new_and_load<B: libcnb::Buildpack>(
context: &BuildContext<B>,
Expand Down Expand Up @@ -124,7 +124,7 @@ impl AppCache {
/// # Errors
///
/// - If the files cannot be moved/coppied into the cache
/// then then an error will be raised.
/// then then an error will be raised.
pub fn save(&self) -> Result<&AppCache, CacheError> {
match self.keep_path {
KeepPath::Runtime => preserve_path_save(self)?,
Expand All @@ -143,7 +143,7 @@ impl AppCache {
/// # Errors
///
/// - If files cannot be moved from the cache to the path
/// then an error will be raised.
/// then an error will be raised.
pub fn load(&self) -> Result<&Self, CacheError> {
fs_err::create_dir_all(&self.path).map_err(CacheError::IoError)?;
fs_err::create_dir_all(&self.cache).map_err(CacheError::IoError)?;
Expand Down Expand Up @@ -186,7 +186,7 @@ impl AppCache {
///
/// - If files cannot be deleted an error will be raised
/// - If the operating system does not support the `mtime` an
/// error will be raised.
/// error will be raised.
/// - If metadata of a file cannot be read, an error will be raised
pub fn save_and_clean(&self) -> Result<Option<FilesWithSize>, CacheError> {
self.save()?;
Expand Down
2 changes: 1 addition & 1 deletion commons/src/cache/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::time::SystemTime;
///
/// - The provided ``cache_path`` is not valid UTF-8 (`OsStringErr`).
/// - Metadata from a file in the ``cache_path`` cannot be retrieved from the OS (`IoError`).
/// this is needed for mtime retrieval to calculate which file is least recently used.
/// this is needed for mtime retrieval to calculate which file is least recently used.
/// - If there's an OS error while deleting a file.
/// - If an internal glob pattern is incorrect
/// - If the OS does not support mtime operation on files.
Expand Down
4 changes: 2 additions & 2 deletions commons/src/output/section_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use std::marker::PhantomData;
/// only downside is that the buildpack author (you) is now responsible for:
///
/// - Ensuring that `Box<dyn StartedLogger>::section()` was called right before any of these
/// functions are called.
/// functions are called.
/// - Ensuring that you are not attempting to log while already logging i.e. calling `step()` within a
/// `step_timed()` call.
/// `step_timed()` call.
///
/// For usage details run `cargo run --bin print_style_guide`
///
Expand Down

0 comments on commit a69f101

Please sign in to comment.