Avoid ref keyword in 2018 style docs
diff --git a/src/expr.rs b/src/expr.rs
index a5f0e3a..ce12cea 100644
--- a/src/expr.rs
+++ b/src/expr.rs
@@ -36,9 +36,10 @@
/// Expr::If(expr) => {
/// /* ... */
/// }
+ ///
/// /* ... */
/// # _ => {}
- /// }
+ /// # }
/// # }
/// ```
///
@@ -50,28 +51,15 @@
/// `expr.receiver`, `expr.args` etc; if we ended up in the `If` case we get
/// to use `expr.cond`, `expr.then_branch`, `expr.else_branch`.
///
- /// The pattern is similar if the input expression is borrowed:
- ///
- /// ```edition2018
- /// # use syn::Expr;
- /// #
- /// # fn example(expr: &Expr) {
- /// match *expr {
- /// Expr::MethodCall(ref expr) => {
- /// # }
- /// # _ => {}
- /// # }
- /// # }
- /// ```
- ///
/// This approach avoids repeating the variant names twice on every line.
///
/// ```edition2018
/// # use syn::{Expr, ExprMethodCall};
/// #
/// # fn example(expr: Expr) {
- /// # match expr {
- /// Expr::MethodCall(ExprMethodCall { method, args, .. }) => { // repetitive
+ /// // Repetitive; recommend not doing this.
+ /// match expr {
+ /// Expr::MethodCall(ExprMethodCall { method, args, .. }) => {
/// # }
/// # _ => {}
/// # }
@@ -84,10 +72,10 @@
/// ```edition2018
/// # use syn::{Expr, ExprField};
/// #
- /// # fn example(discriminant: &ExprField) {
+ /// # fn example(discriminant: ExprField) {
/// // Binding is called `base` which is the name I would use if I were
/// // assigning `*discriminant.base` without an `if let`.
- /// if let Expr::Tuple(ref base) = *discriminant.base {
+ /// if let Expr::Tuple(base) = *discriminant.base {
/// # }
/// # }
/// ```
diff --git a/src/parse.rs b/src/parse.rs
index e651d15..c5786e7 100644
--- a/src/parse.rs
+++ b/src/parse.rs
@@ -305,8 +305,8 @@
/// input.step(|cursor| {
/// let mut rest = *cursor;
/// while let Some((tt, next)) = rest.token_tree() {
-/// match tt {
-/// TokenTree::Punct(ref punct) if punct.as_char() == '@' => {
+/// match &tt {
+/// TokenTree::Punct(punct) if punct.as_char() == '@' => {
/// return Ok(((), next));
/// }
/// _ => rest = next,
@@ -902,8 +902,8 @@
/// input.step(|cursor| {
/// let mut rest = *cursor;
/// while let Some((tt, next)) = rest.token_tree() {
- /// match tt {
- /// TokenTree::Punct(ref punct) if punct.as_char() == '@' => {
+ /// match &tt {
+ /// TokenTree::Punct(punct) if punct.as_char() == '@' => {
/// return Ok(((), next));
/// }
/// _ => rest = next,
diff --git a/src/parse_quote.rs b/src/parse_quote.rs
index 0b9d4d4..08012f5 100644
--- a/src/parse_quote.rs
+++ b/src/parse_quote.rs
@@ -39,7 +39,7 @@
/// // Add a bound `T: HeapSize` to every type parameter T.
/// fn add_trait_bounds(mut generics: Generics) -> Generics {
/// for param in &mut generics.params {
-/// if let GenericParam::Type(ref mut type_param) = *param {
+/// if let GenericParam::Type(type_param) = param {
/// type_param.bounds.push(parse_quote!(HeapSize));
/// }
/// }