use rustc::middle::privacy::AccessLevels;
use rustc::middle::stability;
+use rustc_ast::ast;
use rustc_ast_pretty::pprust;
use rustc_data_structures::flock;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_span::symbol::{sym, Symbol};
use serde::ser::SerializeSeq;
use serde::{Serialize, Serializer};
-use syntax::ast;
use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy};
use crate::config::RenderOptions;
crate fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
crate::html::format::display_fn(move |f| {
- if !v.ends_with("/") && !v.is_empty() { write!(f, "{}/", v) } else { write!(f, "{}", v) }
+ if !v.ends_with('/') && !v.is_empty() { write!(f, "{}/", v) } else { write!(f, "{}", v) }
})
}
fn render_stability_since_raw(w: &mut Buffer, ver: Option<&str>, containing_ver: Option<&str>) {
if let Some(v) = ver {
- if containing_ver != ver && v.len() > 0 {
+ if containing_ver != ver && !v.is_empty() {
write!(w, "<span class='since' title='Stable since Rust version {0}'>{0}</span>", v)
}
}
.filter_map(|attr| attr.meta_item().and_then(|mi| render_attribute(mi)))
.collect();
- if display.len() > 0 { Some(format!("{}({})", path, display.join(", "))) } else { None }
+ if !display.is_empty() { Some(format!("{}({})", path, display.join(", "))) } else { None }
} else {
None
}
attrs.push_str(&format!("#[{}]\n", s));
}
}
- if attrs.len() > 0 {
+ if !attrs.is_empty() {
write!(
w,
"<span class=\"docblock attributes{}\">{}</span>",