Skip to content

1.32: Starting relative paths with self when specified after use already not necessary. #1807

@santids

Description

@santids

Hi There! New to the community.

Reading the book I found this line and decided to try it.

Starting relative paths with self when specified after use might not be neccesary in the future; it’s an inconsistency in the language that people are working on eliminating.

open https://doc.rust-lang.org/book/ch07-02-modules-and-use-to-control-scope-and-privacy.html

Using rustc version 1.32.0 (9fda7c223 2019-01-16), the self keyboard is already not necessary.

The following code compiles without errors

mod sound {
    pub mod instrument {
        pub fn clarinet () {
            super::voice::sing();
            println!("clarinet");

        }
    }

    pub mod voice {
        pub fn sing () {

        }
    }

}

use sound::instrument;
use self::sound::instrument;

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedBlocked on a change we need to make in this repo

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions