Use naming that matches the code’s actual semantics and data contracts—avoid misleading terms and generic parameter names.
Apply these rules:
value; name the expected type/encoding.Example (pattern):
// Misleading: suggests truly removing state when we actually restore.
fn unset_warp_default(&mut self, ctx: &mut ModelContext<Self>) {
self.restore_macos_terminal_as_default(ctx)
}
// Contract-revealing parameter names.
pub fn format_git_branch_command(encoded_branch: &str) -> String {
// encoded_branch is a GitBranchOnClickValue-encoded string
format!("git checkout {encoded_branch}")
}
// Domain-accurate API naming.
pub fn scroll_to_matching_header(&mut self, header: &str) { /* ... */ }
// Clear terminology via an enum when behavior is two-state.
enum FullGridClearBehavior { ClearToTemplate, ScrollIntoScrollback }
Enter the URL of a public GitHub repository