Skip to main content

hoist_absolute_paths

Function hoist_absolute_paths 

Source
pub fn hoist_absolute_paths(file: &mut File)
Expand description

Shorten every crate-rooted path in file that names an item through three or more segments to start at an imported name, and add the use items that import those names.

The function also shortens the paths in a macro call whose body is a list of expressions, such as vec![..]. It leaves use items, visibility paths, qualified paths such as <T as Trait>::f, and every other macro body alone. A path that it cannot shorten without a clash at every level stays as it is.