diff options
| author | Trevor Spiteri <tspiteri@ieee.org> | 2017-01-31 00:57:52 +0100 |
|---|---|---|
| committer | Trevor Spiteri <tspiteri@ieee.org> | 2017-01-31 00:57:52 +0100 |
| commit | fe324cea6490fc6e7ce16fb5209fde57cfa1b94f (patch) | |
| tree | c9be2c088cb7cf67007899d9473ff1c53713eadb | |
| parent | 892170765387ca7bd332900efecf6ec7dc5df700 (diff) | |
| download | rust-fe324cea6490fc6e7ce16fb5209fde57cfa1b94f.tar.gz rust-fe324cea6490fc6e7ce16fb5209fde57cfa1b94f.zip | |
rustdoc: mark ffi functions with unsafety icon
| -rw-r--r-- | src/librustdoc/html/render.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 52257653405..40eb7e5ab78 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1806,12 +1806,13 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, String::new() }; - let mut unsafety_flag = ""; - if let clean::FunctionItem(ref func) = myitem.inner { - if func.unsafety == hir::Unsafety::Unsafe { - unsafety_flag = "<a title='unsafe function' href='#'><sup>⚠</sup></a>"; + let unsafety_flag = match myitem.inner { + clean::FunctionItem(ref func) | clean::ForeignFunctionItem(ref func) + if func.unsafety == hir::Unsafety::Unsafe => { + "<a title='unsafe function' href='#'><sup>⚠</sup></a>" } - } + _ => "", + }; let doc_value = myitem.doc_value().unwrap_or(""); write!(w, " |
