1
Fork 0

Rollup merge of #104786 - WaffleLapkin:amp-mut-help, r=compiler-errors

Use the power of adding helper function to simplify code w/ `Mutability`

r? `@compiler-errors`
This commit is contained in:
Guillaume Gomez 2022-11-26 17:47:23 +01:00 committed by GitHub
commit a2e485c25c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 144 additions and 218 deletions

View file

@ -169,7 +169,7 @@ impl<'hir> Sig for hir::Ty<'hir> {
let mut prefix = "&".to_owned();
prefix.push_str(&lifetime.name.ident().to_string());
prefix.push(' ');
if let hir::Mutability::Mut = mt.mutbl {
if mt.mutbl.is_mut() {
prefix.push_str("mut ");
};
@ -332,7 +332,7 @@ impl<'hir> Sig for hir::Item<'hir> {
match self.kind {
hir::ItemKind::Static(ref ty, m, ref body) => {
let mut text = "static ".to_owned();
if m == hir::Mutability::Mut {
if m.is_mut() {
text.push_str("mut ");
}
let name = self.ident.to_string();