Skip to content

Commit

Permalink
Document From trait for LhsExpr
Browse files Browse the repository at this point in the history
  • Loading branch information
crgl committed Sep 16, 2019
1 parent b9de4ef commit 194d357
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libsyntax/parse/parser/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ pub(super) enum LhsExpr {
}

impl From<Option<ThinVec<Attribute>>> for LhsExpr {
/// Converts `Some(attrs)` into `LhsExpr::AttributesParsed(attrs)`
/// and `None` into `LhsExpr::NotYetParsed`.
///
/// This conversion does not allocate.
fn from(o: Option<ThinVec<Attribute>>) -> Self {
if let Some(attrs) = o {
LhsExpr::AttributesParsed(attrs)
Expand All @@ -76,6 +80,9 @@ impl From<Option<ThinVec<Attribute>>> for LhsExpr {
}

impl From<P<Expr>> for LhsExpr {
/// Converts the `expr: P<Expr>` into `LhsExpr::AlreadyParsed(expr)`.
///
/// This conversion does not allocate.
fn from(expr: P<Expr>) -> Self {
LhsExpr::AlreadyParsed(expr)
}
Expand Down

0 comments on commit 194d357

Please sign in to comment.