Skip to content

Commit

Permalink
Cleanup (#448)
Browse files Browse the repository at this point in the history
- cargo fix
- update all crates to 2018 edition
  • Loading branch information
JasperDeSutter authored and kdy1 committed Nov 17, 2019
1 parent bc4a297 commit 716bfe0
Show file tree
Hide file tree
Showing 161 changed files with 1,140 additions and 1,547 deletions.
1 change: 1 addition & 0 deletions atoms/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ license = "Apache-2.0/MIT"
repository = "https://github.com/swc-project/swc.git"
documentation = "https://swc-project.github.io/rustdoc/swc_atoms/"
description = "Atoms for the swc project."
edition = "2018"

[dependencies]
string_cache = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion atoms/build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extern crate string_cache_codegen;
use string_cache_codegen;

use std::{env, path::Path};

Expand Down
2 changes: 1 addition & 1 deletion atoms/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
extern crate string_cache;
#![allow(clippy::unreadable_literal)]

include!(concat!(env!("OUT_DIR"), "/js_word.rs"));
1 change: 1 addition & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ license = "Apache-2.0/MIT"
repository = "https://github.com/swc-project/swc.git"
documentation = "https://swc-project.github.io/rustdoc/swc_common/"
description = "Common utilities for the swc project."
edition = "2018"

[features]
default = []
Expand Down
1 change: 1 addition & 0 deletions common/benches/and_then.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ extern crate test;
use swc_common::FoldWith;
use test::{black_box, Bencher};

#[allow(clippy::vec_box)]
fn mk_vec() -> Vec<Box<String>> {
(0..1000).map(|s| box s.to_string()).collect()
}
Expand Down
6 changes: 3 additions & 3 deletions common/src/comments.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{BytePos, Span};
use crate::syntax_pos::{BytePos, Span};
use chashmap::{CHashMap, ReadGuard};

type CommentMap = CHashMap<BytePos, Vec<Comment>>;
Expand All @@ -24,11 +24,11 @@ impl Comments {
});
}

pub fn trailing_comments(&self, pos: BytePos) -> Option<ReadGuard<BytePos, Vec<Comment>>> {
pub fn trailing_comments(&self, pos: BytePos) -> Option<ReadGuard<'_, BytePos, Vec<Comment>>> {
self.trailing.get(&pos)
}

pub fn leading_comments(&self, pos: BytePos) -> Option<ReadGuard<BytePos, Vec<Comment>>> {
pub fn leading_comments(&self, pos: BytePos) -> Option<ReadGuard<'_, BytePos, Vec<Comment>>> {
self.leading.get(&pos)
}
}
Expand Down
6 changes: 3 additions & 3 deletions common/src/errors/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
// except according to those terms.

use super::{snippet::Style, Applicability, CodeSuggestion, Level, Substitution, SubstitutionPart};
use crate::syntax_pos::{MultiSpan, Span};
use std::fmt;
use syntax_pos::{MultiSpan, Span};

#[must_use]
#[derive(Clone, Debug, PartialEq, Hash)]
Expand Down Expand Up @@ -38,12 +38,12 @@ pub struct SubDiagnostic {
pub render_span: Option<MultiSpan>,
}

#[derive(PartialEq, Eq)]
#[derive(PartialEq, Eq, Default)]
pub struct DiagnosticStyledString(pub Vec<StringPart>);

impl DiagnosticStyledString {
pub fn new() -> DiagnosticStyledString {
DiagnosticStyledString(vec![])
Default::default()
}
pub fn push_normal<S: Into<String>>(&mut self, t: S) {
self.0.push(StringPart::Normal(t.into()));
Expand Down
6 changes: 3 additions & 3 deletions common/src/errors/diagnostic_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
// except according to those terms.

use super::{Applicability, Diagnostic, DiagnosticId, DiagnosticStyledString, Handler, Level};
use crate::syntax_pos::{MultiSpan, Span};
use log::debug;
use std::{
fmt::{self, Debug},
ops::{Deref, DerefMut},
thread::panicking,
};
use syntax_pos::{MultiSpan, Span};

/// Used for emitting structured error messages and other diagnostic
/// information.
Expand Down Expand Up @@ -126,7 +126,7 @@ impl<'a> DiagnosticBuilder<'a> {
message: &str,
span: Option<S>,
) -> &mut Self {
let span = span.map(|s| s.into()).unwrap_or_else(|| MultiSpan::new());
let span = span.map(|s| s.into()).unwrap_or_else(MultiSpan::new);
self.diagnostic.sub(level, message, span, None);
self
}
Expand Down Expand Up @@ -314,7 +314,7 @@ impl<'a> DiagnosticBuilder<'a> {
}

impl<'a> Debug for DiagnosticBuilder<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
self.diagnostic.fmt(f)
}
}
Expand Down
Loading

0 comments on commit 716bfe0

Please sign in to comment.