Remove warning suppressions and clean up dead code#12
Closed
Copilot wants to merge 5 commits into
Closed
Conversation
…with proper documentation Co-authored-by: tayyebi <[email protected]>
…ecific imports Co-authored-by: tayyebi <[email protected]>
Co-authored-by: tayyebi <[email protected]>
Copilot
AI
changed the title
[WIP] Remove #[allow(dead_code)] suppressions and clean up properties
Remove warning suppressions and clean up dead code
Jan 22, 2026
Contributor
|
@copilot compile it and ensure there are no warnings. |
Copilot stopped work on behalf of
tayyebi due to an error
January 22, 2026 13:00
Contributor
|
@copilot if there is a preseved line, comment out the line itself instead of adding another line of comment to say it is preseved! we dont want compile-time warnings. |
…mpile warnings Co-authored-by: tayyebi <[email protected]>
Contributor
Author
Contributor
|
@copilot check conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The codebase contained 25+
#[allow(dead_code)]and#[allow(unused_imports)]attributes suppressing compiler warnings. This hides useful signals and makes the code harder to maintain.Changes
Deleted dead code:
DEFAULT_ADMIN_ROLEconstantCommented out preserved code:
logo_url,os_compatibility,id,url,created_at,decompress,last_restored_at,is_instance_deleted,region_id) - preserved for future featuresget_iso,delete_iso,get_image,delete_image,get_backup_profile,update_backup_profile,delete_backup_profile) - preserved for future useensure_logged_in,load_instances_for_user_wrapper) - reserved for future route guardsConfirmationAction::to_str()) - reserved for future serializationPermissionDeniedvariant,Channel::should_include_prerelease()) - reserved for future featuresSshKeySelectionFormStep7) - reserved for future wizard stepsRemoved incorrect suppressions:
get_instance_for_actioncalled bycheck_instance_blockprereleaseandassetsfields consumed by update logicRetained suppressions (2):
BaseTemplatetrait:#[allow(dead_code)]- used byimpl_base_template!macro (compiler can't detect macro usage)PermissionsExtimport:#[allow(unused_imports)]in#[cfg(unix)]block - compiler doesn't detect trait usage within conditional compilationResult
Achieved zero compile-time warnings by commenting out all preserved items instead of suppressing warnings. All unused code is clearly marked with inline comments explaining why it's preserved. The build completes cleanly in both debug and release modes with no warnings.
Original prompt
Remove #[allow(dead_code)] suppressions and clean up unused/redundant properties
Problem
The codebase contains multiple
#[allow(dead_code)]and#[allow(unused_imports)]attributes that suppress compiler warnings rather than properly addressing the underlying issues. This is not a good practice as it:OpenAPI Schema Reference
The API schema has been provided in
openapi.jsonand defines the actual structure of API responses. Properties in the Rust structs should align with this schema.Files to Fix
1.
src/config.rsDEFAULT_ADMIN_ROLEconstant is marked with#[allow(dead_code)]but is never used2.
src/api/applications.rsApplicationstruct haslogo_urlandos_compatibilityfields marked with#[allow(dead_code)]ApplicationSchema), these fields exist in the API response:logoUrlmaps tologo_urlosListmaps toos_compatibility#[allow(dead_code)]and actually use them in the display logic, OR3.
src/api/iso.rsIsoViewstruct hascreated_atfield marked with#[allow(dead_code)]createdAtfield in the main schema4.
src/api/images.rsImageViewstruct hasdecompressandcreated_atfields marked with#[allow(dead_code)]5.
src/api/backups.rsBackupProfileViewstruct hascreated_atfield marked with#[allow(dead_code)]6.
src/update/mod.rs#[allow(unused_imports)]suppressions7.
src/update/error.rsUpdateErrorenum variants marked with#[allow(dead_code)]:NoAssetFoundUnsupportedPlatformPermissionDenied8.
src/update/channel.rsChannel::should_include_prerelease()method marked with#[allow(dead_code)]9.
src/update/asset.rs#[allow(dead_code)]:parse_asset_name()select_asset_for_platform()10.
src/update/platform.rsPlatformstruct and its implementation marked with#[allow(dead_code)]11.
src/templates/base_template.rsBaseTemplatetrait marked with#[allow(dead_code)]with comment "Used by impl_base_template! macro, but compiler doesn't detect it"12.
src/models/confirmation.rsConfirmationAction::to_str()method marked with#[allow(dead_code)]13.
src/handlers/helpers.rsensure_logged_in()function marked with#[allow(dead_code)]Action Items
For each file above:
#[allow(dead_code)]or#[allow(unused_imports)]attributeTesting
After making changes:
cargo buildto ensure no compilation errorscargo clippyto check for warningsThis pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.