diff --git a/Cargo.toml b/Cargo.toml index 1e8fb54a826..e5db1081db4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,6 +87,13 @@ exclude = [ resolver = "2" +[workspace.lints.rust.unexpected_cfgs] +level = "warn" +check-cfg = [ + 'cfg(target_os, values("solana"))', + 'cfg(feature, values("frozen-abi", "no-entrypoint"))', +] + [workspace.metadata.release] pre-release-commit-message = "Publish {{crate_name}} v{{version}}" tag-message = "Publish {{crate_name}} v{{version}}" diff --git a/binary-option/program/Cargo.toml b/binary-option/program/Cargo.toml index 20f336f7291..5f0469d1486 100644 --- a/binary-option/program/Cargo.toml +++ b/binary-option/program/Cargo.toml @@ -20,3 +20,6 @@ uint = "0.10" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/binary-oracle-pair/program/Cargo.toml b/binary-oracle-pair/program/Cargo.toml index 31cfe7b8b33..3e1f23b1451 100644 --- a/binary-oracle-pair/program/Cargo.toml +++ b/binary-oracle-pair/program/Cargo.toml @@ -27,3 +27,6 @@ solana-sdk = "2.1.0" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/examples/rust/custom-heap/Cargo.toml b/examples/rust/custom-heap/Cargo.toml index 276ac0d9348..93eaca3022e 100644 --- a/examples/rust/custom-heap/Cargo.toml +++ b/examples/rust/custom-heap/Cargo.toml @@ -26,3 +26,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/feature-proposal/program/Cargo.toml b/feature-proposal/program/Cargo.toml index e7bccc3eaae..8674db7f34a 100644 --- a/feature-proposal/program/Cargo.toml +++ b/feature-proposal/program/Cargo.toml @@ -27,3 +27,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/governance/addin-mock/program/Cargo.toml b/governance/addin-mock/program/Cargo.toml index 4fd5e41780b..ee3b020bd17 100644 --- a/governance/addin-mock/program/Cargo.toml +++ b/governance/addin-mock/program/Cargo.toml @@ -38,3 +38,6 @@ spl-governance-test-sdk = { version = "0.1.4", path = "../../test-sdk" } [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/governance/chat/program/Cargo.toml b/governance/chat/program/Cargo.toml index f0e962bca8e..6dc6ca44e4a 100644 --- a/governance/chat/program/Cargo.toml +++ b/governance/chat/program/Cargo.toml @@ -42,3 +42,6 @@ spl-governance-addin-mock = { version = "0.1.4", path = "../../addin-mock/progra [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/governance/program/Cargo.toml b/governance/program/Cargo.toml index 88aff814725..808d7562267 100644 --- a/governance/program/Cargo.toml +++ b/governance/program/Cargo.toml @@ -39,3 +39,6 @@ spl-governance-addin-mock = { version = "0.1.4", path = "../addin-mock/program" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/libraries/program-error/derive/src/lib.rs b/libraries/program-error/derive/src/lib.rs index 2681e85be4e..026b0eb7d0f 100644 --- a/libraries/program-error/derive/src/lib.rs +++ b/libraries/program-error/derive/src/lib.rs @@ -68,9 +68,9 @@ pub fn print_program_error(input: TokenStream) -> TokenStream { /// a unique `u32` _starting_ error codes from the names of the enum variants. /// Notes: /// - The _error_ variant will start at this value, and the rest will be -/// incremented by one +/// incremented by one /// - The value provided is only for code readability, the actual error code -/// will be a hash of the input string and is checked against your input +/// will be a hash of the input string and is checked against your input /// /// Syntax: `#[spl_program_error(hash_error_code_start = 1275525928)]` /// Hash Input: `spl_program_error::` diff --git a/memo/program/src/lib.rs b/memo/program/src/lib.rs index fa792b8bb81..b92e480a811 100644 --- a/memo/program/src/lib.rs +++ b/memo/program/src/lib.rs @@ -27,7 +27,7 @@ solana_program::declare_id!("MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"); /// Accounts expected by this instruction: /// /// 0. ..0+N. `[signer]` Expected signers; if zero provided, instruction will -/// be processed as a normal, unsigned spl-memo +/// be processed as a normal, unsigned spl-memo pub fn build_memo(memo: &[u8], signer_pubkeys: &[&Pubkey]) -> Instruction { Instruction { program_id: id(), diff --git a/record/program/Cargo.toml b/record/program/Cargo.toml index ba5d1e41ed1..395d8abaffb 100644 --- a/record/program/Cargo.toml +++ b/record/program/Cargo.toml @@ -28,3 +28,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/single-pool/program/Cargo.toml b/single-pool/program/Cargo.toml index 73bb6175c4b..b4ddc82daff 100644 --- a/single-pool/program/Cargo.toml +++ b/single-pool/program/Cargo.toml @@ -39,3 +39,6 @@ approx = "0.5.1" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/stake-pool/program/Cargo.toml b/stake-pool/program/Cargo.toml index 3578e7cba4f..ad4c5c35550 100644 --- a/stake-pool/program/Cargo.toml +++ b/stake-pool/program/Cargo.toml @@ -47,3 +47,6 @@ test-case = "3.3" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/stake-pool/program/src/state.rs b/stake-pool/program/src/state.rs index a10a2652915..831c18779ef 100644 --- a/stake-pool/program/src/state.rs +++ b/stake-pool/program/src/state.rs @@ -765,7 +765,6 @@ impl Sealed for ValidatorStakeInfo {} impl Pack for ValidatorStakeInfo { const LEN: usize = 73; fn pack_into_slice(&self, data: &mut [u8]) { - let data = data; // Removing this unwrap would require changing from `Pack` to some other // trait or `bytemuck`, so it stays in for now borsh::to_writer(data, self).unwrap(); diff --git a/stateless-asks/program/Cargo.toml b/stateless-asks/program/Cargo.toml index 68fb97d2164..582426cd3ed 100644 --- a/stateless-asks/program/Cargo.toml +++ b/stateless-asks/program/Cargo.toml @@ -28,3 +28,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/token-group/interface/src/instruction.rs b/token-group/interface/src/instruction.rs index 2ba4306683b..3a7b927e3d0 100644 --- a/token-group/interface/src/instruction.rs +++ b/token-group/interface/src/instruction.rs @@ -245,11 +245,6 @@ pub fn initialize_member( mod test { use {super::*, crate::NAMESPACE, solana_program::hash}; - #[repr(C)] - #[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable, SplDiscriminate)] - #[discriminator_hash_input("mock_group")] - struct MockGroup; - fn instruction_pack_unpack(instruction: TokenGroupInstruction, discriminator: &[u8], data: I) where I: core::fmt::Debug + PartialEq + Pod + Zeroable + SplDiscriminate, diff --git a/token-lending/flash_loan_receiver/src/processor.rs b/token-lending/flash_loan_receiver/src/processor.rs index 0f145dc28d9..f9f9c350fbd 100644 --- a/token-lending/flash_loan_receiver/src/processor.rs +++ b/token-lending/flash_loan_receiver/src/processor.rs @@ -61,7 +61,7 @@ fn unpack_amount(input: &[u8]) -> Result { .and_then(|slice| slice.try_into().ok()) .map(u64::from_le_bytes) .ok_or(ProgramError::InvalidInstructionData) - .inspect_err(|e| { + .inspect_err(|_| { msg!("Failed to unpack amount."); })?; Ok(amount) diff --git a/token-lending/program/Cargo.toml b/token-lending/program/Cargo.toml index 9a4eb04f8b6..9c65cb886be 100644 --- a/token-lending/program/Cargo.toml +++ b/token-lending/program/Cargo.toml @@ -29,3 +29,6 @@ solana-sdk = "2.1.0" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/token-lending/program/src/instruction.rs b/token-lending/program/src/instruction.rs index 5455ef92b7e..80de917043f 100644 --- a/token-lending/program/src/instruction.rs +++ b/token-lending/program/src/instruction.rs @@ -67,13 +67,13 @@ pub enum LendingInstruction { /// 8. `[]` Pyth product account. /// 9. `[]` Pyth price account. This will be used as the reserve liquidity /// oracle account. - /// 10 `[]` Lending market account. - /// 11 `[]` Derived lending market authority. - /// 12 `[signer]` Lending market owner. - /// 13 `[signer]` User transfer authority ($authority). - /// 14 `[]` Clock sysvar. - /// 15 `[]` Rent sysvar. - /// 16 `[]` Token program id. + /// 10. `[]` Lending market account. + /// 11. `[]` Derived lending market authority. + /// 12. `[signer]` Lending market owner. + /// 13. `[signer]` User transfer authority ($authority). + /// 14. `[]` Clock sysvar. + /// 15. `[]` Rent sysvar. + /// 16. `[]` Token program id. InitReserve { /// Initial amount of liquidity to deposit into the new reserve liquidity_amount: u64, @@ -158,9 +158,8 @@ pub enum LendingInstruction { /// /// 0. `[writable]` Obligation account. /// 1. `[]` Clock sysvar. - /// .. `[]` Collateral deposit reserve accounts - refreshed, all, in - /// order. .. `[]` Liquidity borrow reserve accounts - refreshed, all, - /// in order. + /// .. `[]` Collateral deposit reserve accounts - refreshed, all, in order. + /// .. `[]` Liquidity borrow reserve accounts - refreshed, all, in order. RefreshObligation, // 8 @@ -227,7 +226,7 @@ pub enum LendingInstruction { /// 7. `[signer]` Obligation owner. /// 8. `[]` Clock sysvar. /// 9. `[]` Token program id. - /// 10 `[optional, writable]` Host fee receiver account. + /// 10. `[optional, writable]` Host fee receiver account. BorrowObligationLiquidity { /// Amount of liquidity to borrow - u64::MAX for 100% of borrowing power liquidity_amount: u64, @@ -276,8 +275,8 @@ pub enum LendingInstruction { /// 7. `[]` Lending market account. /// 8. `[]` Derived lending market authority. /// 9. `[signer]` User transfer authority ($authority). - /// 10 `[]` Clock sysvar. - /// 11 `[]` Token program id. + /// 10. `[]` Clock sysvar. + /// 11. `[]` Token program id. LiquidateObligation { /// Amount of liquidity to repay - u64::MAX for up to 100% of borrowed /// amount @@ -303,7 +302,7 @@ pub enum LendingInstruction { /// 8. `[]` Flash loan receiver program id. Must implement an instruction /// that has tag of 0 and a signature of `(amount: u64)` This /// instruction must return the amount to the source liquidity account. - /// .. `[any]` Additional accounts expected by the receiving program's + /// .. `[any]` Additional accounts expected by the receiving program's /// `ReceiveFlashLoan` instruction. /// /// The flash loan receiver program that is to be invoked should contain @@ -323,7 +322,7 @@ pub enum LendingInstruction { /// `FlashLoan` instruction above. ReceiveFlashLoan { /// // Amount that must be repaid by the receiver program /// amount: u64 - /// } + /// } FlashLoan { /// The amount that is to be borrowed - u64::MAX for up to 100% of /// available liquidity diff --git a/token-wrap/program/Cargo.toml b/token-wrap/program/Cargo.toml index e33a9fd7ced..80020c42d48 100644 --- a/token-wrap/program/Cargo.toml +++ b/token-wrap/program/Cargo.toml @@ -25,3 +25,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/token/confidential-transfer/elgamal-registry/Cargo.toml b/token/confidential-transfer/elgamal-registry/Cargo.toml index 52bd2ac9c7d..49c76f1079d 100644 --- a/token/confidential-transfer/elgamal-registry/Cargo.toml +++ b/token/confidential-transfer/elgamal-registry/Cargo.toml @@ -23,3 +23,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/token/confidential-transfer/proof-generation/Cargo.toml b/token/confidential-transfer/proof-generation/Cargo.toml index 9028085dfb7..a14d9c17a54 100644 --- a/token/confidential-transfer/proof-generation/Cargo.toml +++ b/token/confidential-transfer/proof-generation/Cargo.toml @@ -16,3 +16,6 @@ thiserror = "1.0.65" [lib] crate-type = ["cdylib", "lib"] + +[lints] +workspace = true diff --git a/token/program-2022/Cargo.toml b/token/program-2022/Cargo.toml index 0f1db6fb28f..5461a95cf05 100644 --- a/token/program-2022/Cargo.toml +++ b/token/program-2022/Cargo.toml @@ -57,3 +57,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true diff --git a/token/program/Cargo.toml b/token/program/Cargo.toml index 120db36bfc7..3b363fb5b43 100644 --- a/token/program/Cargo.toml +++ b/token/program/Cargo.toml @@ -33,3 +33,6 @@ crate-type = ["cdylib", "lib"] [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[lints] +workspace = true