Fix lints

This commit is contained in:
강동윤 2019-10-19 12:47:25 +09:00
parent 01b1cc1a5e
commit 34c3a0ece9
8 changed files with 18 additions and 18 deletions

View File

@ -13,7 +13,7 @@ pub(crate) struct InjectSelf {
}
#[cfg(procmacro2_semver_exempt)]
fn get_joinned_span(t: &ToTokens) -> Span {
fn get_joinned_span(t: &dyn ToTokens) -> Span {
let tts: TokenStream = t.dump().into();
let (mut first, mut last) = (None, None);
for tt in tts {
@ -29,7 +29,7 @@ fn get_joinned_span(t: &ToTokens) -> Span {
}
#[cfg(not(procmacro2_semver_exempt))]
fn get_joinned_span(t: &ToTokens) -> Span {
fn get_joinned_span(t: &dyn ToTokens) -> Span {
let tts: TokenStream = t.dump().into();
let mut first = None;
for tt in tts {
@ -113,7 +113,7 @@ impl Fold for InjectSelf {
let tts = if i.tts.is_empty() {
quote_spanned!(span => #parser).into()
} else {
let mut args: Punctuated<Expr, token::Comma> = parse_args(i.tts.into());
let args: Punctuated<Expr, token::Comma> = parse_args(i.tts.into());
let args = args
.into_pairs()
.map(|el| el.map_item(|expr| self.fold_expr(expr)))

View File

@ -66,8 +66,8 @@ pub struct Emitter<'a> {
pub cfg: config::Config,
pub cm: Arc<SourceMap>,
pub comments: Option<&'a Comments>,
pub wr: Box<('a + WriteJs)>,
pub handlers: Box<('a + Handlers)>,
pub wr: Box<(dyn 'a + WriteJs)>,
pub handlers: Box<(dyn 'a + Handlers)>,
pub pos_of_leading_comments: HashSet<BytePos>,
}

View File

@ -23,7 +23,7 @@ pub trait SpanExt: Spanned {
impl<T: Spanned> SpanExt for T {}
pub trait SourceMapperExt {
fn get_code_map(&self) -> &SourceMapper;
fn get_code_map(&self) -> &dyn SourceMapper;
fn is_on_same_line(&self, lo: BytePos, hi: BytePos) -> bool {
let cm = self.get_code_map();
@ -122,19 +122,19 @@ pub trait SourceMapperExt {
}
}
}
impl SourceMapperExt for SourceMapper {
fn get_code_map(&self) -> &SourceMapper {
impl SourceMapperExt for dyn SourceMapper {
fn get_code_map(&self) -> &dyn SourceMapper {
self
}
}
impl SourceMapperExt for Arc<SourceMapperDyn> {
fn get_code_map(&self) -> &SourceMapper {
fn get_code_map(&self) -> &dyn SourceMapper {
&**self
}
}
impl SourceMapperExt for Arc<SourceMap> {
fn get_code_map(&self) -> &SourceMapper {
fn get_code_map(&self) -> &dyn SourceMapper {
&**self
}
}

View File

@ -19,7 +19,7 @@ struct InjectSelf {
}
#[cfg(procmacro2_semver_exempt)]
fn get_joinned_span(t: &ToTokens) -> Span {
fn get_joinned_span(t: &dyn ToTokens) -> Span {
let tts: TokenStream = t.dump().into();
let (mut first, mut last) = (None, None);
for tt in tts {
@ -35,7 +35,7 @@ fn get_joinned_span(t: &ToTokens) -> Span {
}
#[cfg(not(procmacro2_semver_exempt))]
fn get_joinned_span(t: &ToTokens) -> Span {
fn get_joinned_span(t: &dyn ToTokens) -> Span {
let tts: TokenStream = t.dump().into();
let mut first = None;
for tt in tts {

View File

@ -149,7 +149,7 @@ impl<'a, I: Input> Lexer<'a, I> {
return self.read_radix_number(radix).map(Num).map(Some);
}
'1'...'9' => return self.read_number(false).map(Num).map(Some),
'1'..='9' => return self.read_number(false).map(Num).map(Some),
'"' | '\'' => return self.read_str_lit().map(Some),
@ -401,7 +401,7 @@ impl<'a, I: Input> Lexer<'a, I> {
return self.read_unicode_escape(start, raw).map(Some);
}
// octal escape sequences
'0'...'7' => {
'0'..='7' => {
self.bump();
let first_c = if c == '0' {
match self.cur() {

View File

@ -87,7 +87,7 @@ impl<'a, I: Input> Lexer<'a, I> {
// Read numbers after dot
let dec_val = self.read_int(10, 0, &mut Raw(None))?;
let dec: &Display = match dec_val {
let dec: &dyn Display = match dec_val {
Some(ref n) => n,
// "0.", "0.e1" is valid
None => &"",

View File

@ -77,7 +77,7 @@ pub fn derive(input: DeriveInput) -> ItemImpl {
fn make_body_for_variant(v: &VariantBinder, bindings: Vec<BindedField>) -> Box<Expr> {
/// `swc_common::Spanned::span(#field)`
fn simple_field(field: &ToTokens) -> Box<Expr> {
fn simple_field(field: &dyn ToTokens) -> Box<Expr> {
Box::new(
Quote::new(def_site::<Span>())
.quote_with(smart_quote!(Vars { field }, {

View File

@ -177,8 +177,8 @@ where
tt => panic!(
"expected tokens to be wrapped in a paren like #[kind(tokens)]\ngot {}",
match tt {
Some(ref tt) => tt as &Display,
None => &"None" as &Display,
Some(ref tt) => tt as &dyn Display,
None => &"None" as &dyn Display,
}
),
}