Skip to content

Naming of mut_/_mut is inconsistent #21415

@kornelski

Description

@kornelski

I don't get rules around mut prefix/suffix naming, if there are any. When I try to guess where _mut_ will be in a method name, I most often get it wrong.

There's .as_mut_ptr(), but there's also ptr::null_mut(). Shouldn't one of them be ptr::mut_null() or .as_ptr_mut()?

There's plenty of prefix methods as_mut_something(), e.g. .as_mut_slice(), but there's also suffix .get_mut, .iter_mut() and .last_mut. Then why not .as_something_mut()? (like .mut_edge_data)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions