Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing minor Rust warnings #171

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions programs/mpl-core/src/plugins/lifecycle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl ExternalCheckResult {

/// Bitfield representation of lifecycle permissions for external plugin adapter, third party plugins.
#[bitfield(bits = 32)]
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
#[derive(Eq, PartialEq, Copy, Clone, Debug, Default)]
pub struct ExternalCheckResultBits {
pub can_listen: bool,
pub can_approve: bool,
Expand Down Expand Up @@ -1016,22 +1016,6 @@ pub(crate) trait PluginValidation {
abstain!()
}

/// Validate the add_authority lifecycle action.
fn validate_add_authority(
&self,
_ctx: &PluginValidationContext,
) -> Result<ValidationResult, ProgramError> {
abstain!()
}

/// Validate the add_authority lifecycle action.
fn validate_remove_authority(
&self,
_ctx: &PluginValidationContext,
) -> Result<ValidationResult, ProgramError> {
abstain!()
}

/// Validate the update_plugin lifecycle action.
fn validate_update_external_plugin_adapter(
&self,
Expand Down
6 changes: 4 additions & 2 deletions programs/mpl-core/src/plugins/plugin_registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,15 @@ impl ExternalRegistryRecord {
ExternalPluginAdapterUpdateInfo::LifecycleHook(update_info) => {
if let Some(checks) = &update_info.lifecycle_checks {
validate_lifecycle_checks(checks, false)?;
self.lifecycle_checks = update_info.lifecycle_checks.clone()
self.lifecycle_checks
.clone_from(&update_info.lifecycle_checks)
}
}
ExternalPluginAdapterUpdateInfo::Oracle(update_info) => {
if let Some(checks) = &update_info.lifecycle_checks {
validate_lifecycle_checks(checks, true)?;
self.lifecycle_checks = update_info.lifecycle_checks.clone()
self.lifecycle_checks
.clone_from(&update_info.lifecycle_checks)
}
}
_ => (),
Expand Down
2 changes: 1 addition & 1 deletion programs/mpl-core/src/plugins/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ pub fn initialize_external_plugin_adapter<'a, T: DataBlob + SolanaAccount>(
}

pub(crate) fn validate_lifecycle_checks(
lifecycle_checks: &Vec<(HookableLifecycleEvent, ExternalCheckResult)>,
lifecycle_checks: &[(HookableLifecycleEvent, ExternalCheckResult)],
can_reject_only: bool,
) -> ProgramResult {
if lifecycle_checks.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion programs/mpl-core/src/processor/burn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
state::{AssetV1, CollectionV1, CompressionProof, Key, SolanaAccount, Wrappable},
utils::{
close_program_account, load_key, rebuild_account_state_from_proof_data, resolve_authority,
validate_asset_permissions, validate_collection_permissions, verify_proof,
validate_asset_permissions, verify_proof,
},
};

Expand Down
Loading