]> git.lizzy.rs Git - rust.git/commitdiff
don't lazily evaulate some trivial values for Option::None replacements (clippy:...
authorMatthias Krüger <matthias.krueger@famsik.de>
Tue, 15 Sep 2020 21:10:24 +0000 (23:10 +0200)
committerMatthias Krüger <matthias.krueger@famsik.de>
Tue, 15 Sep 2020 21:17:51 +0000 (23:17 +0200)
compiler/rustc_lint/src/builtin.rs
compiler/rustc_metadata/src/native_libs.rs

index efdb7489ba5b0d766ac18cc3de6d6f0e35f2923e..5b5dbcf192ca16caf6fb17405e658de0df370372 100644 (file)
@@ -961,7 +961,7 @@ fn warn_if_doc(cx: &EarlyContext<'_>, node_span: Span, node_kind: &str, attrs: &
             continue;
         }
 
-        let span = sugared_span.take().unwrap_or_else(|| attr.span);
+        let span = sugared_span.take().unwrap_or(attr.span);
 
         if attr.is_doc_comment() || cx.sess().check_name(attr, sym::doc) {
             cx.struct_span_lint(UNUSED_DOC_COMMENTS, span, |lint| {
index 3976475cb063e4b02713d983f32a90ceb9dd1e91..e76c2cb356f3f19b8dc6508f1a46e37bd3e44928 100644 (file)
@@ -170,7 +170,7 @@ fn register_native_lib(&mut self, span: Option<Span>, lib: NativeLib) {
             feature_err(
                 &self.tcx.sess.parse_sess,
                 sym::static_nobundle,
-                span.unwrap_or_else(|| rustc_span::DUMMY_SP),
+                span.unwrap_or(rustc_span::DUMMY_SP),
                 "kind=\"static-nobundle\" is unstable",
             )
             .emit();
@@ -179,7 +179,7 @@ fn register_native_lib(&mut self, span: Option<Span>, lib: NativeLib) {
             feature_err(
                 &self.tcx.sess.parse_sess,
                 sym::raw_dylib,
-                span.unwrap_or_else(|| rustc_span::DUMMY_SP),
+                span.unwrap_or(rustc_span::DUMMY_SP),
                 "kind=\"raw-dylib\" is unstable",
             )
             .emit();