chore(close-account): rename UserState to User#29
Merged
mikemaccana merged 2 commits intoMay 15, 2026
Merged
Conversation
Applies the repo-wide convention that state structs do not carry the 'State' suffix. The struct is the data; 'state' is implicit in being an on-chain account (compare: Offer, not OfferState; Counter, not CounterState). Affected: - Anchor: programs/close-account/src/state/user_state.rs renamed to state/user.rs; pub struct UserState -> pub struct User; module pub mod user_state; -> pub mod user;. All callers updated. - Quasar: src/state.rs pub struct UserState -> pub struct User; the set_inner-generated UserStateInner becomes UserInner. All callers updated. - basics/close-account/anchor/README.md updated to match. Not changed: - state.rs / state/ module and directory names keep their names. The 'state' module is a fine container for state types; only the *struct* names are being renamed. Verification: cargo check clean on both basics/close-account/anchor and basics/close-account/quasar.
…te-to-user # Conflicts: # basics/close-account/anchor/README.md
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.
What
Rename the
UserStatestruct toUserin thebasics/close-accountexample (Anchor and Quasar ports).Why
Repo-wide convention: state structs do not carry the
Statesuffix. The struct is the data; "state" is implicit in being an on-chain account. Same idea asOffernot being calledOfferState, orCounternot beingCounterState.Renames
pub struct UserState→pub struct Userinprograms/close-account/src/state/user_state.rsstate/user_state.rs→state/user.rspub mod user_state;→pub mod user;pub struct UserState→pub struct Userinsrc/state.rsset_inner-generatedUserStateInnerbecomesUserInnerNot changed
state.rsfiles keep their names (stateis a fine module name).state/directories keep their names (same reason).UpdateDefaultStateintokens/token-extensions/default-account-state/is NOT a state struct — it's an Anchor accounts-context for theupdate_default_stateinstruction. "DefaultState" refers to the Token Extensions feature name "Default Account State". Left alone.Verification
cargo checkclean on bothbasics/close-account/anchorandbasics/close-account/quasar.