Skip to content

False positive for empty_line_after_outer_attr with #[doc=""] attribute #2460

Closed
@pftbest

Description

@pftbest

This code produces a warning:

#[doc = "
Returns the escaped value of the textual representation of
its arguments in a form suitable for embedding in a URL query.

# Example
``
use gtmpl::template;
let url = template(r#\"{{ urlquery \"foo bar?\" }}\"#, 0);
assert_eq!(&url.unwrap(), \"foo%20bar%3F\");
``
"]
pub fn urlquery(args: &[Arc<Value>]) -> Result<Arc<Value>, String> {
    if args.len() != 1 {
        return Err(String::from("urlquery requires one argument"));
    }

    match *args[0] {
        Value::String(ref s) => Ok(varc!(
            utf8_percent_encode(s, DEFAULT_ENCODE_SET).to_string()
        )),
        _ => Err(String::from("Arguments need to be of type String")),
    }
}
warning: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
   --> src/funcs.rs:383:1
    |
383 | / #[doc = "
384 | | Returns the escaped value of the textual representation of
385 | | its arguments in a form suitable for embedding in a URL query.
386 | |
...   |
393 | | "]
394 | | pub fn urlquery(args: &[Arc<Value>]) -> Result<Arc<Value>, String> {
    | |_
    |
    = note: #[warn(empty_line_after_outer_attr)] on by default
    = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.186/index.html#empty_line_after_outer_attr

cc @phansch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions