Update compiler (#725)

* update compiler to recent nightly

* cargo fmt

* fix clippy

but ructe code is still complaining

* update circleci and rocket_csrf

* fix last clippy problems

* cargo fmt

* fix build issue

was caused be improper handling of recursive template (comment) by old ructe, which is fixed on newer version
This commit is contained in:
fdb-hiroshima
2020-01-19 12:52:32 +01:00
committed by Ana Gelez
parent 72464fb428
commit 3663bffe5c
30 changed files with 201 additions and 155 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
#![feature(custom_attribute, associated_type_defaults)]
#![feature(associated_type_defaults)]
extern crate activitypub;
#[macro_use]
+6 -6
View File
@@ -146,7 +146,7 @@ fn inline_tags<'a>(
}
}
pub type MediaProcessor<'a> = Box<'a + Fn(i32) -> Option<(String, Option<String>)>>;
pub type MediaProcessor<'a> = Box<dyn 'a + Fn(i32) -> Option<(String, Option<String>)>>;
fn process_image<'a, 'b>(
evt: Event<'a>,
@@ -157,9 +157,7 @@ fn process_image<'a, 'b>(
match evt {
Event::Start(Tag::Image(id, title)) => {
if let Some((url, cw)) = id.parse::<i32>().ok().and_then(processor.as_ref()) {
if inline || cw.is_none() {
Event::Start(Tag::Image(Cow::Owned(url), title))
} else {
if let (Some(cw), false) = (cw, inline) {
// there is a cw, and where are not inline
Event::Html(Cow::Owned(format!(
r#"<label for="postcontent-cw-{id}">
@@ -170,9 +168,11 @@ fn process_image<'a, 'b>(
</span>
<img src="{url}" alt=""#,
id = random_hex(),
cw = cw.unwrap(),
cw = cw,
url = url
)))
} else {
Event::Start(Tag::Image(Cow::Owned(url), title))
}
} else {
Event::Start(Tag::Image(id, title))
@@ -247,7 +247,7 @@ pub fn md_to_html<'a>(
text_acc.push(c)
}
let mention = text_acc;
let short_mention = mention.splitn(1, '@').nth(0).unwrap_or("");
let short_mention = mention.splitn(1, '@').next().unwrap_or("");
let link = Tag::Link(
format!("{}@/{}/", base_url, &mention).into(),
short_mention.to_owned().into(),