Context: I wanted to create a helper function in clippy_utils which would turn <expr> (a snippet) into &<expr> or &mut <expr>, depending on provided mutbl: Mutability. In the middle of writing it, I realized that it won't work as is, because Clippy has both early and late lints, thus works with bost AST and HIR data structures, among which there are ast::Mutability and hir::Mutability, respectively, and so the callers would want to call the function with either of these.
One way to solve this would be to provide two methods, "addrify_ast" and "addrify_hir", but that would of course be less than ideal -- hence my question: wouldn't it be desirable to deduplicate these enums? I completely understand why this isn't done for ast/hir/middle::Expr/Ty/Pat etc., but AFAICS the Mutabilitys have pretty much identical methods and trait impls, so I can't imagine this being a controversial idea?
Another option would be to provide a From impl, but I guess it would be wasteful to make rustc_ast or rustc_hir depend on each just to be able to name the other one's Mutability in said From impl -- not to mention that that would create a circular dependency.
Do let me know if there's something else I'm missing.