Skip to content

Docs: unchecked file.write() in example #51621

Closed
@yongqli

Description

@yongqli

In the example for LineWriter there is this code fragment:

    for &byte in road_not_taken.iter() {
       file.write(&[byte]).unwrap();
    }

This code isn't correct -- it should be file.write_all instead. In fact, trying the run the example fails on play.rust-lang.org.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions