Properly indent pub fns in extern blocks
This commit is contained in:
parent
00aa232834
commit
5407202fdf
@ -273,7 +273,7 @@ pub fn rewrite_array<'a, I>(expr_iter: I,
|
|||||||
let has_long_item = try_opt!(items.iter()
|
let has_long_item = try_opt!(items.iter()
|
||||||
.map(|li| li.item.as_ref().map(|s| s.len() > 10))
|
.map(|li| li.item.as_ref().map(|s| s.len() > 10))
|
||||||
.fold(Some(false),
|
.fold(Some(false),
|
||||||
|acc, x| acc.and_then(|y| x.map(|x| (x || y)))));
|
|acc, x| acc.and_then(|y| x.map(|x| x || y))));
|
||||||
|
|
||||||
let tactic = if has_long_item || items.iter().any(ListItem::is_multiline) {
|
let tactic = if has_long_item || items.iter().any(ListItem::is_multiline) {
|
||||||
definitive_tactic(&items, ListTactic::HorizontalVertical, max_item_width)
|
definitive_tactic(&items, ListTactic::HorizontalVertical, max_item_width)
|
||||||
|
@ -143,14 +143,13 @@ fn format_foreign_item(&mut self, item: &ast::ForeignItem) {
|
|||||||
// These are not actually rust functions,
|
// These are not actually rust functions,
|
||||||
// but we format them as such.
|
// but we format them as such.
|
||||||
abi::Abi::Rust,
|
abi::Abi::Rust,
|
||||||
ast::Visibility::Inherited,
|
item.vis,
|
||||||
span,
|
span,
|
||||||
false,
|
false,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
match rewrite {
|
match rewrite {
|
||||||
Some((new_fn, _)) => {
|
Some((new_fn, _)) => {
|
||||||
self.buffer.push_str(format_visibility(item.vis));
|
|
||||||
self.buffer.push_str(&new_fn);
|
self.buffer.push_str(&new_fn);
|
||||||
self.buffer.push_str(";");
|
self.buffer.push_str(";");
|
||||||
}
|
}
|
||||||
|
@ -26,3 +26,11 @@
|
|||||||
fn foo (x: *const c_char , ... ) ->
|
fn foo (x: *const c_char , ... ) ->
|
||||||
libc::c_long;
|
libc::c_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern {
|
||||||
|
pub fn freopen(filename: *const c_char, mode: *const c_char
|
||||||
|
, mode2: *const c_char
|
||||||
|
, mode3: *const c_char,
|
||||||
|
file: *mut FILE)
|
||||||
|
-> *mut FILE;
|
||||||
|
}
|
||||||
|
@ -15,3 +15,12 @@ mod qux {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod boxed { pub use std::boxed::{Box, HEAP}; }
|
mod boxed { pub use std::boxed::{Box, HEAP}; }
|
||||||
|
|
||||||
|
mod x {
|
||||||
|
pub fn freopen(filename: *const c_char,
|
||||||
|
mode: *const c_char,
|
||||||
|
mode2: *const c_char,
|
||||||
|
mode3: *const c_char,
|
||||||
|
file: *mut FILE)
|
||||||
|
-> *mut FILE{}
|
||||||
|
}
|
||||||
|
@ -36,3 +36,12 @@ fn syscall(number: libc::c_long, // comment 1
|
|||||||
|
|
||||||
fn foo(x: *const c_char, ...) -> libc::c_long;
|
fn foo(x: *const c_char, ...) -> libc::c_long;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern {
|
||||||
|
pub fn freopen(filename: *const c_char,
|
||||||
|
mode: *const c_char,
|
||||||
|
mode2: *const c_char,
|
||||||
|
mode3: *const c_char,
|
||||||
|
file: *mut FILE)
|
||||||
|
-> *mut FILE;
|
||||||
|
}
|
||||||
|
@ -24,3 +24,13 @@ mod qux {
|
|||||||
mod boxed {
|
mod boxed {
|
||||||
pub use std::boxed::{Box, HEAP};
|
pub use std::boxed::{Box, HEAP};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mod x {
|
||||||
|
pub fn freopen(filename: *const c_char,
|
||||||
|
mode: *const c_char,
|
||||||
|
mode2: *const c_char,
|
||||||
|
mode3: *const c_char,
|
||||||
|
file: *mut FILE)
|
||||||
|
-> *mut FILE {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user