fn suggest_mut_for_immutable(&self, pty: &hir::Ty, is_implicit_self: bool) -> Option<String> {
        // Check wether the argument is an immutable reference
        debug!("suggest_mut_for_immutable({:?}, {:?})", pty, is_implicit_self);
        if let hir::TyRptr(lifetime, hir::MutTy {
            mutbl: hir::Mutability::MutImmutable,
            ref ty
        }) = pty.node {
            // Account for existing lifetimes when generating the message
            let pointee_snippet = match self.tcx.sess.codemap().span_to_snippet(ty.span) {
                Ok(snippet) => snippet,
                _ => return None
            };

            let lifetime_snippet = if !lifetime.is_elided() {
                format!("{} ", match self.tcx.sess.codemap().span_to_snippet(lifetime.span) {
                    Ok(lifetime_snippet) => lifetime_snippet,
                    _ => return None
                })
            } else {
                String::new()
            };
            Some(format!("use `&{}mut {}` here to make mutable",
                         lifetime_snippet,
                         if is_implicit_self { "self" } else { &*pointee_snippet }))
        } else {
            None
        }
    }
/// Given a type, if it is an immutable reference, return a suggestion to make it mutable
Given a type, if it is an immutable reference, return a suggestion to make it mutable
Given a type if it is an immutable reference return a suggestion to make it mutable
fn suggest_mut_for_immutable(&self, pty: &hir::Ty, is_implicit_self: bool) -> Option<String> {
        // Check wether the argument is an immutable reference
        debug!("suggest_mut_for_immutable({:?}, {:?})", pty, is_implicit_self);
        if let hir::TyRptr(lifetime, hir::MutTy {
            mutbl: hir::Mutability::MutImmutable,
            ref ty
        }) = pty.node {
            // Account for existing lifetimes when generating the message
            let pointee_snippet = match self.tcx.sess.codemap().span_to_snippet(ty.span) {
                Ok(snippet) => snippet,
                _ => return None
            };
            let lifetime_snippet = if !lifetime.is_elided() {
                format!("{} ", match self.tcx.sess.codemap().span_to_snippet(lifetime.span) {
                    Ok(lifetime_snippet) => lifetime_snippet,
                    _ => return None
                })
            } else {
                String::new()
            };
            Some(format!("use `&{}mut {}` here to make mutable",
                         lifetime_snippet,
                         if is_implicit_self { "self" } else { &*pointee_snippet }))
        } else {
            None
        }
    }
fn suggest_mut_for_immutable ( & self , pty : & hir :: Ty , is_implicit_self : bool ) -> Option < String > { // Check wether the argument is an immutable reference debug ! ( " " pty is_implicit_self ) ; if let hir :: TyRptr ( lifetime , hir :: MutTy { mutbl : hir :: Mutability :: MutImmutable , ref ty } ) = pty . node { // Account for existing lifetimes when generating the message let pointee_snippet = match self . tcx . sess . codemap ( ) . span_to_snippet ( ty . span ) { Ok ( snippet ) => snippet , _ => return None } ; let lifetime_snippet = if ! lifetime . is_elided ( ) { format ! ( " " match self tcx sess codemap ( ) span_to_snippet ( lifetime span ) { Ok ( lifetime_snippet ) lifetime_snippet return None } ) } else { String :: new ( ) } ; Some ( format ! ( " " lifetime_snippet if is_implicit_self { " " } else { pointee_snippet } ) ) } else { None } }
Given a type, if it is an immutable reference, return a suggestion to make it mutable
Given a type if it is an immutable reference return a suggestion to make it mutable
&self
pty
&hir::Ty
is_implicit_self
bool
&self
pty
&hir::Ty
is_implicit_self
bool