Skip to content

fix(cli): resolve cfg directive warnings in default project templates (#3740) #3748

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

Conversation

hasip-timurtas
Copy link
Contributor

Fixes #3740

This pull request refines the Rust template for Solana programs in cli/src/rust_template.rs. Key updates include removing outdated configurations, adding new debugging and customization options, and introducing linting rules for better code quality.

Removal of outdated configurations:

  • Removed references to Xargo.toml as it is no longer needed for modern Solana builds using SBF. ([cli/src/rust_template.rsL40-R40](https://github.com/solana-foundation/anchor/pull/3748/files#diff-caba398fa4ca1762b150abb98bffb6a49bb4398c43e900e588511209a88aa453L40-R40))
  • Eliminated the xargo_toml function and its associated configuration for BPF targets, as it is now obsolete. ([cli/src/rust_template.rsL221-L226](https://github.com/solana-foundation/anchor/pull/3748/files#diff-caba398fa4ca1762b150abb98bffb6a49bb4398c43e900e588511209a88aa453L221-L226))

Addition of debugging and customization options:

  • Added new features: anchor-debug, custom-heap, and custom-panic to enhance debugging and allow custom memory and error-handling configurations. ([cli/src/rust_template.rsR207-R217](https://github.com/solana-foundation/anchor/pull/3748/files#diff-caba398fa4ca1762b150abb98bffb6a49bb4398c43e900e588511209a88aa453R207-R217))

Code quality improvements:

  • Introduced linting rules under [lints.rust] to warn about unexpected configurations, specifically targeting cfg(target_os, values("solana")). ([cli/src/rust_template.rsR207-R217](https://github.com/solana-foundation/anchor/pull/3748/files#diff-caba398fa4ca1762b150abb98bffb6a49bb4398c43e900e588511209a88aa453R207-R217))

…st_template.rs

This commit eliminates the deprecated Xargo.toml file reference and adds new dependencies for modern Solana builds, enhancing the project's compatibility and maintainability.
Copy link

vercel bot commented Jun 18, 2025

@hasip-timurtas is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@Aursen Aursen added the Patch Change that can be done in a patch release label Jun 20, 2025
@Aursen
Copy link
Collaborator

Aursen commented Jun 20, 2025

Great one @jacobcreech

Copy link
Collaborator

@jacobcreech jacobcreech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution!

@hasip-timurtas
Copy link
Contributor Author

Thank you @Aursen @jacobcreech!

Regarding the CI failures, they are from existing Clippy warnings and formatting issues in master, not related to the rust_template.rs changes in this PR.

To keep this PR focused, I've opened #3751 to address all the CI blockers separately:

  • Fixed clippy warnings (obfuscated-if-else, result-large-err, io-other-error)
  • Fixed TypeScript formatting in test files

Once #3751 is merged, this PR should pass all checks without any modifications needed.

@jacobcreech jacobcreech merged commit 3f833a5 into solana-foundation:master Jun 28, 2025
102 of 105 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Patch Change that can be done in a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

missing / invalid cfg directives and deprecated calls in default project
3 participants