1
Fork 0

adressed comments by @kennytm and @petrochenkov

This commit is contained in:
Andre Bogus 2017-05-13 21:40:06 +02:00
parent a9c163ebe9
commit 958c67d9c8
9 changed files with 41 additions and 38 deletions

View file

@ -111,7 +111,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
// overflow the maximum line width.
description.map(|raw_msg| {
let msg = raw_msg.as_str();
if !msg.starts_with('\n') || !msg.ends_with('\n') {
if !msg.starts_with("\n") || !msg.ends_with("\n") {
ecx.span_err(span, &format!(
"description for error code {} doesn't start and end with a newline",
code
@ -120,7 +120,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt,
// URLs can be unavoidably longer than the line limit, so we allow them.
// Allowed format is: `[name]: https://www.rust-lang.org/`
let is_url = |l: &str| l.starts_with('[') && l.contains("]:") && l.contains("http");
let is_url = |l: &str| l.starts_with("[") && l.contains("]:") && l.contains("http");
if msg.lines().any(|line| line.len() > MAX_DESCRIPTION_WIDTH && !is_url(line)) {
ecx.span_err(span, &format!(