rust/compiler/rustc_expand/src/mbe
Nicholas Nethercote 01e33a3600 Avoid &format("...") calls in error message code.
Error message all end up passing into a function as an `impl
Into<{D,Subd}iagnosticMessage>`. If an error message is creatd as
`&format("...")` that means we allocate a string (in the `format!`
call), then take a reference, and then clone (allocating again) the
reference to produce the `{D,Subd}iagnosticMessage`, which is silly.

This commit removes the leading `&` from a lot of these cases. This
means the original `String` is moved into the
`{D,Subd}iagnosticMessage`, avoiding the double allocations. This
requires changing some function argument types from `&str` to `String`
(when all arguments are `String`) or `impl
Into<{D,Subd}iagnosticMessage>` (when some arguments are `String` and
some are `&str`).
2023-05-16 17:59:56 +10:00
..
diagnostics.rs Avoid &format("...") calls in error message code. 2023-05-16 17:59:56 +10:00
macro_check.rs Avoid &format("...") calls in error message code. 2023-05-16 17:59:56 +10:00
macro_parser.rs Lrc -> Rc 2023-04-30 13:24:10 +03:00
macro_rules.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
metavar_expr.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
quoted.rs Restrict From<S> for {D,Subd}iagnosticMessage. 2023-05-03 08:44:39 +10:00
transcribe.rs Avoid &format("...") calls in error message code. 2023-05-16 17:59:56 +10:00