diff --git a/src/web/page/templates.rs b/src/web/page/templates.rs index b312160d2..3145fb3ab 100644 --- a/src/web/page/templates.rs +++ b/src/web/page/templates.rs @@ -92,7 +92,6 @@ pub mod filters { use chrono::{DateTime, Utc}; use rinja::filters::Safe; use std::borrow::Cow; - use std::fmt; // Copied from `tera`. pub fn escape_html(input: &str) -> rinja::Result> { @@ -247,26 +246,14 @@ pub mod filters { } } - pub fn unwrap(value: &Option) -> rinja::Result<&T> { - Ok(value.as_ref().expect("`unwrap` filter failed")) - } - pub fn split_first<'a>(value: &'a str, pat: &str) -> rinja::Result> { Ok(value.split(pat).next()) } - pub fn to_string(value: &T) -> rinja::Result { - Ok(value.to_string()) - } - pub fn json_encode(value: &T) -> rinja::Result { Ok(serde_json::to_string(value).expect("`encode_json` failed")) } - pub fn as_f32(value: &i32) -> rinja::Result { - Ok(*value as f32) - } - pub fn rest_menu_url(current_target: &str, inner_path: &str) -> rinja::Result { if current_target.is_empty() { return Ok(String::new()); diff --git a/templates/crate/details.html b/templates/crate/details.html index 18386f8dd..6d4e023db 100644 --- a/templates/crate/details.html +++ b/templates/crate/details.html @@ -26,8 +26,8 @@
    {%- if let (Some(documented), Some(total)) = (documented_items, total_items) -%} - {% set documented_f32 = documented|as_f32 %} - {% set total_f32 = total|as_f32 %} + {% set documented_f32 = documented as f32 %} + {% set total_f32 = total as f32 %} {% set percent = documented_f32 * 100f32 / total_f32 %}
  • Coverage
  • {{ percent|round(2) }}%
    diff --git a/templates/rustdoc/head.html b/templates/rustdoc/head.html index 3320daa4a..a865b5bd7 100644 --- a/templates/rustdoc/head.html +++ b/templates/rustdoc/head.html @@ -1,5 +1,5 @@ {%- import "macros.html" as macros -%} - + diff --git a/templates/rustdoc/topbar.html b/templates/rustdoc/topbar.html index b7d11bd74..7eb80f079 100644 --- a/templates/rustdoc/topbar.html +++ b/templates/rustdoc/topbar.html @@ -36,7 +36,7 @@ {%- include "clipboard.svg" -%}
  • - {%- if metadata.req_version|to_string == "latest" -%} + {%- if metadata.req_version.to_string() == "latest" -%}