use std::borrow::Cow;
use syntax::{abi, ptr};
-use syntax::ast::{self, Attribute, MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind,
- Path, Visibility};
+use syntax::ast::{self, Attribute, CrateSugar, MetaItem, MetaItemKind, NestedMetaItem,
+ NestedMetaItemKind, Path, Visibility};
use syntax::codemap::{BytePos, Span, NO_EXPANSION};
use rewrite::RewriteContext;
use shape::Shape;
// When we get scoped annotations, we should have rustfmt::skip.
-const SKIP_ANNOTATION: &'static str = "rustfmt_skip";
+const SKIP_ANNOTATION: &str = "rustfmt_skip";
// Computes the length of a string's last line, minus offset.
pub fn extra_offset(text: &str, shape: Shape) -> usize {
match *vis {
Visibility::Public => Cow::from("pub "),
Visibility::Inherited => Cow::from(""),
- Visibility::Crate(_) => Cow::from("pub(crate) "),
+ Visibility::Crate(_, CrateSugar::PubCrate) => Cow::from("pub(crate) "),
+ Visibility::Crate(_, CrateSugar::JustCrate) => Cow::from("crate "),
Visibility::Restricted { ref path, .. } => {
let Path { ref segments, .. } = **path;
let mut segments_iter = segments.iter().map(|seg| seg.identifier.name.to_string());
impl<'de> ::serde::de::Deserialize<'de> for $e {
fn deserialize<D>(d: D) -> Result<Self, D::Error>
where D: ::serde::Deserializer<'de> {
- use std::ascii::AsciiExt;
use serde::de::{Error, Visitor};
use std::marker::PhantomData;
use std::fmt;
type Err = &'static str;
fn from_str(s: &str) -> Result<Self, Self::Err> {
- use std::ascii::AsciiExt;
$(
if stringify!($x).eq_ignore_ascii_case(s) {
return Ok($e::$x);