Skip to content

for: replace range() function with range notation #389

@genbattle

Description

@genbattle

I was updating old code of mine and got this warning for one of my code files:

main.rs:15:14: 15:19 warning: use of unstable item: will be replaced by range notation, #[warn(unstable)] on by default
main.rs:15     for i in range(1, 1000) {

I pulled up Rust by Example to see what the new idiomatic way of doing this was and found that Rust by Example was using the same (apparently unstable) syntax. The Rust book also uses the outdated syntax.

So at the moment there's no straightforward up-to-date resources on what the syntax should be. But apparently it involves Rust's new [a..b] range syntax. Can someone with more knowledge about what the syntax should be please update Rust by Example.

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