Skip to content

Commit b69084c

Browse files
author
Ariel Ben-Yehuda
committed
weak_lang_items: check for lang attribute before calling value_str
improves trans performance by *another* 10%.
1 parent 74a819c commit b69084c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustc/middle/lang_items.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,10 @@ impl<'a, 'tcx> LanguageItemCollector<'a, 'tcx> {
223223

224224
pub fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
225225
for attribute in attrs {
226-
match attribute.value_str() {
227-
Some(value) if attribute.check_name("lang") => return Some(value),
228-
_ => {}
226+
if attribute.check_name("lang") {
227+
if let Some(value) = attribute.value_str() {
228+
return Some(value)
229+
}
229230
}
230231
}
231232

0 commit comments

Comments
 (0)