Skip to content

Commit

Permalink
fix: final clippy pedantic fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
encody committed May 8, 2024
1 parent a403734 commit 3ef424a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/approval/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,11 @@ where
/// once.
fn init(config: C);

/// Creates a new action request initialized with the given approval state
/// Creates a new action request initialized with the given approval state.
///
/// # Errors
///
/// - If the acting account is unauthorized.
fn create_request(
&mut self,
action: A,
Expand All @@ -204,23 +208,42 @@ where

/// Executes an action request and removes it from the collection if the
/// approval state of the request is fulfilled.
///
/// # Errors
///
/// - If the acting account is unauthorized.
/// - If the request is ineligible for execution.
fn execute_request(
&mut self,
request_id: u32,
) -> Result<A::Output, ExecutionError<C::AuthorizationError, C::ExecutionEligibilityError>>;

/// Is the given request ID able to be executed if such a request were to
/// be initiated by an authorized account?
///
/// # Errors
///
/// - If the request is ineligible for execution.
fn is_approved_for_execution(request_id: u32) -> Result<(), C::ExecutionEligibilityError>;

/// Tries to approve the action request designated by the given request ID
/// with the given arguments. Panics if the request ID does not exist.
///
/// # Errors
///
/// - If the acting account is unauthorized.
/// - If another error was encountered when approving the request.
fn approve_request(
&mut self,
request_id: u32,
) -> Result<(), ApprovalError<C::AuthorizationError, C::ApprovalError>>;

/// Tries to remove the action request indicated by `request_id`.
///
/// # Errors
///
/// - If the acting account is unauthorized.
/// - If the request cannot be removed.
fn remove_request(
&mut self,
request_id: u32,
Expand Down
4 changes: 4 additions & 0 deletions src/approval/simple_multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ impl<Au: AccountAuthorizer> Configuration<Au> {
}

/// Is the given approval state still considered valid?
///
/// # Panics
///
/// - If the request timestamp is in the future.
#[must_use]
pub fn is_within_validity_period(&self, approval_state: &ApprovalState) -> bool {
if self.validity_period_nanoseconds == 0 {
Expand Down
1 change: 1 addition & 0 deletions tests/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ mod integration {
pub value: u32,
}

#[allow(clippy::needless_pass_by_value)]
#[near]
impl Integration {
#[init]
Expand Down
1 change: 1 addition & 0 deletions tests/macros/standard/nep145.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ mod tests {
.predecessor_account_id(alice())
.build());

#[allow(clippy::cast_possible_truncation)]
contract.use_storage(
one_near
.as_yoctonear()
Expand Down

0 comments on commit 3ef424a

Please sign in to comment.