Fix empty trim_newline panic, add impl macro test
This commit is contained in:
parent
c408245e5d
commit
f5fac4c54f
@ -146,7 +146,11 @@ pub fn semicolon_for_stmt(stmt: &ast::Stmt) -> bool {
|
||||
pub fn trim_newlines(input: &str) -> &str {
|
||||
let start = input.find(|c| c != '\n' && c != '\r').unwrap_or(0);
|
||||
let end = input.rfind(|c| c != '\n' && c != '\r').unwrap_or(0) + 1;
|
||||
&input[start..end]
|
||||
if start == 0 && end == 1 {
|
||||
input
|
||||
} else {
|
||||
&input[start..end]
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
@ -51,3 +51,10 @@ mod b {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo { add_fun!(); }
|
||||
|
||||
impl Blah {
|
||||
fn boop() {}
|
||||
add_fun!();
|
||||
}
|
||||
|
@ -63,3 +63,12 @@ mod b {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Foo {
|
||||
add_fun!();
|
||||
}
|
||||
|
||||
impl Blah {
|
||||
fn boop() {}
|
||||
add_fun!();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user