• R
    Fix spurious warning on empty proc macro crates · e1bffbdf
    Ryan Cumming 提交于
    While attempting to reproduce rust-lang/rust#47086 I noticed the
    following warning:
    
    ```shell
    > rustc /dev/null --crate-type proc-macro
    warning: unused variable: `registrar`
     --> /dev/null:0:1
    ```
    
    As there are no macros to register the automatically generated registrar
    function for the crate has no body. As a result its `registrar` argument
    is unused triggering the above warning.
    
    The warning is confusing and not easily actionable by the developer. It
    could also be triggered legitimately by e.g. having all of the macros in
    a crate #[cfg]'ed out.
    
    Fix by naming the generated argument `_registrar` inside
    `mk_registrar()`. This suppresses the unused variable warning.
    e1bffbdf
empty-crate.rs 546 字节