Skip to content

Bad example in FnOnce documentation #47091

Closed
@alercah

Description

@alercah

In the documentation for FnOnce, there are two examples. The first is

let x = 5;
let square_x = move || x * x;
assert_eq!(square_x(), 25);

This is not a FnOnce closure, as it never moves out of a variable in a way that would prevent it from calling again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-mediumCall for participation: Medium difficulty. Experience needed to fix: Intermediate.P-mediumMedium priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions