diff --git a/build.rs b/build.rs index 64fa8d40571..35a3b10a77a 100644 --- a/build.rs +++ b/build.rs @@ -1,13 +1,3 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::env; use std::path::Path; diff --git a/rls-analysis/Cargo.toml b/rls-analysis/Cargo.toml index c397b95deda..915731911ec 100644 --- a/rls-analysis/Cargo.toml +++ b/rls-analysis/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "rls-analysis" version = "0.17.0" +edition = "2018" authors = ["Nick Cameron "] description = "Library for processing rustc's save-analysis data for the RLS" license = "Apache-2.0/MIT" diff --git a/rls-analysis/benches/std_api_crate.rs b/rls-analysis/benches/std_api_crate.rs index 564bd5c56c7..826def5a910 100644 --- a/rls-analysis/benches/std_api_crate.rs +++ b/rls-analysis/benches/std_api_crate.rs @@ -1,11 +1,3 @@ -// Copyright 2017 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #![feature(test)] extern crate rls_analysis; diff --git a/rls-analysis/src/analysis.rs b/rls-analysis/src/analysis.rs index 5a9120c46c4..4590bcbbcb2 100644 --- a/rls-analysis/src/analysis.rs +++ b/rls-analysis/src/analysis.rs @@ -1,19 +1,11 @@ -// Copyright 2017 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use fst; use std::collections::{HashMap, HashSet}; use std::iter; use std::path::{Path, PathBuf}; use std::time::SystemTime; -use raw::{CrateId, DefKind}; -use {Id, Span, SymbolQuery}; +use crate::raw::{CrateId, DefKind}; +use crate::{Id, Span, SymbolQuery}; /// This is the main database that contains all the collected symbol information, /// such as definitions, their mapping between spans, hierarchy and so on, diff --git a/rls-analysis/src/lib.rs b/rls-analysis/src/lib.rs index 63e9e2727cd..84663140d66 100644 --- a/rls-analysis/src/lib.rs +++ b/rls-analysis/src/lib.rs @@ -1,22 +1,12 @@ -// Copyright 2016 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. +#![warn(rust_2018_idioms)] #[macro_use] extern crate derive_new; #[macro_use] extern crate log; -extern crate fst; -extern crate itertools; -extern crate json; + extern crate rls_data as data; extern crate rls_span as span; -extern crate serde; -extern crate serde_json; mod analysis; mod listings; @@ -136,7 +126,7 @@ impl AnalysisHost { analysis: Vec, path_prefix: &Path, base_dir: &Path, - blacklist: Blacklist, + blacklist: Blacklist<'_>, ) -> AResult<()> { self.reload_with_blacklist(path_prefix, base_dir, blacklist)?; @@ -160,7 +150,7 @@ impl AnalysisHost { &self, path_prefix: &Path, base_dir: &Path, - blacklist: Blacklist, + blacklist: Blacklist<'_>, ) -> AResult<()> { trace!("reload_with_blacklist {:?} {:?} {:?}", path_prefix, base_dir, blacklist); let empty = self.analysis.lock()?.is_none(); @@ -190,7 +180,7 @@ impl AnalysisHost { &self, path_prefix: &Path, base_dir: &Path, - blacklist: Blacklist, + blacklist: Blacklist<'_>, ) -> AResult<()> { trace!("hard_reload {:?} {:?}", path_prefix, base_dir); // We're going to create a dummy AnalysisHost that we will fill with data, @@ -551,7 +541,7 @@ impl AnalysisHost { } impl ::std::fmt::Display for Id { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { self.0.fmt(f) } } @@ -566,7 +556,7 @@ impl ::std::error::Error for AError { } impl ::std::fmt::Display for AError { - fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { write!(f, "{}", ::std::error::Error::description(self)) } } diff --git a/rls-analysis/src/listings/mod.rs b/rls-analysis/src/listings/mod.rs index 495ee607a80..e74b2199b73 100644 --- a/rls-analysis/src/listings/mod.rs +++ b/rls-analysis/src/listings/mod.rs @@ -1,11 +1,3 @@ -// Copyright 2016 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use std::io; use std::path::Path; use std::time::SystemTime; diff --git a/rls-analysis/src/loader.rs b/rls-analysis/src/loader.rs index eb9b52c6d14..d9c25a44619 100644 --- a/rls-analysis/src/loader.rs +++ b/rls-analysis/src/loader.rs @@ -1,11 +1,3 @@ -// Copyright 2017 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! Defines an `AnalysisLoader` trait, which allows to specify directories //! from which save-analysis JSON files can be read. Also supplies a //! default implementation `CargoAnalysisLoader` for Cargo-emitted save-analysis @@ -17,7 +9,7 @@ use std::fmt; use std::path::{Path, PathBuf}; use std::process::Command; -use AnalysisHost; +use crate::AnalysisHost; #[derive(Debug)] pub struct CargoAnalysisLoader { @@ -150,7 +142,7 @@ pub enum Target { } impl fmt::Display for Target { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Target::Release => write!(f, "release"), Target::Debug => write!(f, "debug"), diff --git a/rls-analysis/src/lowering.rs b/rls-analysis/src/lowering.rs index fed0d8235b4..d69254d5c5b 100644 --- a/rls-analysis/src/lowering.rs +++ b/rls-analysis/src/lowering.rs @@ -1,20 +1,12 @@ -// Copyright 2016 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - //! For processing the raw save-analysis data from rustc into the rls //! in-memory representation. -use analysis::{Def, Glob, PerCrateAnalysis, Ref}; +use crate::analysis::{Def, Glob, PerCrateAnalysis, Ref}; use data; -use loader::AnalysisLoader; -use raw::{self, CrateId, DefKind, RelationKind}; -use util; -use {AResult, AnalysisHost, Id, Span, NULL}; +use crate::loader::AnalysisLoader; +use crate::raw::{self, CrateId, DefKind, RelationKind}; +use crate::util; +use crate::{AResult, AnalysisHost, Id, Span, NULL}; use span; diff --git a/rls-analysis/src/raw.rs b/rls-analysis/src/raw.rs index 1dc5870a68c..77996fa3907 100644 --- a/rls-analysis/src/raw.rs +++ b/rls-analysis/src/raw.rs @@ -1,19 +1,11 @@ -// Copyright 2016 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - use data::config::Config; use data::Analysis; pub use data::{ CratePreludeData, Def, DefKind, GlobalCrateId as CrateId, Import, Ref, Relation, RelationKind, SigElement, Signature, SpanData, }; -use listings::{DirectoryListing, ListingKind}; -use {AnalysisLoader, Blacklist}; +use crate::listings::{DirectoryListing, ListingKind}; +use crate::{AnalysisLoader, Blacklist}; use std::collections::HashMap; use std::fs::File; @@ -52,7 +44,7 @@ impl Crate { pub fn read_analysis_from_files( loader: &L, crate_timestamps: HashMap, - crate_blacklist: Blacklist, + crate_blacklist: Blacklist<'_>, ) -> Vec { let mut result = vec![]; @@ -99,7 +91,7 @@ pub fn read_analysis_from_files( result } -fn ignore_data(file_name: &str, crate_blacklist: Blacklist) -> bool { +fn ignore_data(file_name: &str, crate_blacklist: Blacklist<'_>) -> bool { crate_blacklist.iter().any(|name| file_name.starts_with(&format!("lib{}-", name))) } diff --git a/rls-analysis/src/symbol_query.rs b/rls-analysis/src/symbol_query.rs index ac12940c072..7fdc3a46c3f 100644 --- a/rls-analysis/src/symbol_query.rs +++ b/rls-analysis/src/symbol_query.rs @@ -57,7 +57,7 @@ impl SymbolQuery { stream.union() } - pub(crate) fn search_stream(&self, mut stream: fst::map::Union, f: F) -> Vec + pub(crate) fn search_stream(&self, mut stream: fst::map::Union<'_>, f: F) -> Vec where F: Fn(&mut Vec, &fst::map::IndexedValue), { diff --git a/rls-analysis/src/test/mod.rs b/rls-analysis/src/test/mod.rs index 5aa68eaab8d..64a0a8713c1 100644 --- a/rls-analysis/src/test/mod.rs +++ b/rls-analysis/src/test/mod.rs @@ -1,21 +1,10 @@ -// Copyright 2016 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use loader::SearchDirectory; -use raw::DefKind; -use {AnalysisHost, AnalysisLoader}; +use crate::loader::SearchDirectory; +use crate::raw::DefKind; +use crate::{AnalysisHost, AnalysisLoader}; use std::collections::HashSet; use std::path::{Path, PathBuf}; -#[cfg(test)] -extern crate env_logger; - #[derive(Clone, new)] struct TestAnalysisLoader { path: PathBuf, diff --git a/rls-analysis/src/util.rs b/rls-analysis/src/util.rs index d5e8a82f78a..7cd970b259b 100644 --- a/rls-analysis/src/util.rs +++ b/rls-analysis/src/util.rs @@ -1,11 +1,3 @@ -// Copyright 2016 The RLS Project Developers. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - #[cfg(unix)] pub fn get_resident() -> Option { use std::fs::File; diff --git a/rls-blacklist/Cargo.toml b/rls-blacklist/Cargo.toml index eebb2ab8b8a..c06658aa03a 100644 --- a/rls-blacklist/Cargo.toml +++ b/rls-blacklist/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "rls-blacklist" version = "0.1.3" +edition = "2018" authors = ["Nick Cameron "] description = "Blacklist of crates for the RLS to skip" license = "Apache-2.0/MIT" diff --git a/rls-rustc/Cargo.toml b/rls-rustc/Cargo.toml index 82c6ea16b26..b12657bc661 100644 --- a/rls-rustc/Cargo.toml +++ b/rls-rustc/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "rls-rustc" version = "0.6.0" +edition = "2018" authors = ["Nick Cameron "] description = "A simple shim around rustc to allow using save-analysis with a stable toolchain" license = "Apache-2.0/MIT" diff --git a/rls-rustc/src/bin/rustc.rs b/rls-rustc/src/bin/rustc.rs index bb13b725686..ff2480aa288 100644 --- a/rls-rustc/src/bin/rustc.rs +++ b/rls-rustc/src/bin/rustc.rs @@ -1,5 +1,3 @@ -extern crate rls_rustc; - fn main() { rls_rustc::run(); } diff --git a/rls-vfs/Cargo.toml b/rls-vfs/Cargo.toml index 3e1d778c9f3..b56e5561bbb 100644 --- a/rls-vfs/Cargo.toml +++ b/rls-vfs/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "rls-vfs" version = "0.8.0" +edition = "2018" authors = ["Nick Cameron "] description = "Virtual File System for the RLS" license = "Apache-2.0/MIT" diff --git a/rls-vfs/src/lib.rs b/rls-vfs/src/lib.rs index e59c9718583..8b697ee6ec5 100644 --- a/rls-vfs/src/lib.rs +++ b/rls-vfs/src/lib.rs @@ -1,3 +1,5 @@ +#![warn(rust_2018_idioms)] + extern crate rls_span as span; #[macro_use] extern crate log; @@ -150,7 +152,7 @@ impl Into for Error { } impl fmt::Display for Error { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Error::OutOfSync(ref path_buf) => { write!(f, "file {} out of sync with filesystem", path_buf.display())