diff options
| author | klensy <klensy@users.noreply.github.com> | 2021-02-23 23:56:04 +0300 |
|---|---|---|
| committer | klensy <klensy@users.noreply.github.com> | 2021-02-23 23:56:04 +0300 |
| commit | 5ff1be197eaa8a014718b26b1fcbe0ced33b6e1a (patch) | |
| tree | 697e81ac40c38223d77eb7128a6a460166748137 /compiler/rustc_macros/src | |
| parent | 446d4533e89db04f9568be4199e56b5fce0d176d (diff) | |
| download | rust-5ff1be197eaa8a014718b26b1fcbe0ced33b6e1a.tar.gz rust-5ff1be197eaa8a014718b26b1fcbe0ced33b6e1a.zip | |
replaced some unwrap_or with unwrap_or_else
Diffstat (limited to 'compiler/rustc_macros/src')
| -rw-r--r-- | compiler/rustc_macros/src/query.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_macros/src/session_diagnostic.rs | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_macros/src/query.rs b/compiler/rustc_macros/src/query.rs index 3e67525567f..763f13d17ef 100644 --- a/compiler/rustc_macros/src/query.rs +++ b/compiler/rustc_macros/src/query.rs @@ -378,14 +378,14 @@ fn add_query_description_impl( let t = &(t.0).0; quote! { #t } }) - .unwrap_or(quote! { _ }); + .unwrap_or_else(|| quote! { _ }); let value = args .as_ref() .map(|t| { let t = &(t.1).0; quote! { #t } }) - .unwrap_or(quote! { _ }); + .unwrap_or_else(|| quote! { _ }); // expr is a `Block`, meaning that `{ #expr }` gets expanded // to `{ { stmts... } }`, which triggers the `unused_braces` lint. quote! { diff --git a/compiler/rustc_macros/src/session_diagnostic.rs b/compiler/rustc_macros/src/session_diagnostic.rs index 5c061a9d3c7..8a0fce209b7 100644 --- a/compiler/rustc_macros/src/session_diagnostic.rs +++ b/compiler/rustc_macros/src/session_diagnostic.rs @@ -473,9 +473,9 @@ impl<'a> SessionDiagnosticDeriveBuilder<'a> { .map( |applicability_idx| quote!(#binding.#applicability_idx), ) - .unwrap_or(quote!( - rustc_errors::Applicability::Unspecified - )); + .unwrap_or_else(|| { + quote!(rustc_errors::Applicability::Unspecified) + }); return Ok((span, applicability)); } throw_span_err!( |
