Skip to content

Suggest &string[6..11] for str::from_utf8(string.as_bytes()[6..11]).unwrap() #5487

Closed
@Luro02

Description

@Luro02

This

use std::str;

let string = "Hello World!";
assert_eq!(str::from_utf8(string.as_bytes()[6..11]).unwrap(), "World");

could be written as

let string = "Hello World!";
assert_eq!(&string[6..11], "World");

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsL-complexityLint: Belongs in the complexity lint groupL-suggestionLint: Improving, adding or fixing lint suggestionsgood first issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions