E0084#
Warning name: unqualified_record
A struct literal bound directly by a let has no explicit T:: type prefix.
Even when a binding annotation identifies the type, keeping the prefix on the
literal makes the constructed type explicit.
Erroneous example#
The type annotation identifies the struct type, but the literal itself remains unqualified:
///|
pub struct Point {
x : Int
y : Int
}
///|
pub fn origin() -> Point {
let point : Point = { x: 0, y: 0 }
point
}
Suggestion#
Prefix the literal with the struct type and let the binding type be inferred.
///|
pub struct Point {
x : Int
y : Int
}
///|
pub fn origin() -> Point {
let point = Point::{ x: 0, y: 0 }
point
}