From ae29291a2f39b2b5bce9f9e76626944a024d42bf Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 9 Jul 2019 00:29:45 +0200 Subject: [PATCH 1/6] Convert rls-rustc to 2018 edition --- rls-rustc/Cargo.toml | 1 + rls-rustc/src/bin/rustc.rs | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) 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(); } From 056e56e169b2228823f6f9a2f56de4a94212bd98 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 9 Jul 2019 00:31:02 +0200 Subject: [PATCH 2/6] Convert rls-blacklist to 2018 edition --- rls-blacklist/Cargo.toml | 1 + 1 file changed, 1 insertion(+) 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" From 3678630f3719bdaa54e72dc86352f335b5c3d598 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 9 Jul 2019 00:37:09 +0200 Subject: [PATCH 3/6] Convert rls-analysis to 2018 edition --- rls-analysis/Cargo.toml | 1 + rls-analysis/src/analysis.rs | 4 ++-- rls-analysis/src/loader.rs | 2 +- rls-analysis/src/lowering.rs | 10 +++++----- rls-analysis/src/raw.rs | 4 ++-- rls-analysis/src/test/mod.rs | 6 +++--- 6 files changed, 14 insertions(+), 13 deletions(-) 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/src/analysis.rs b/rls-analysis/src/analysis.rs index 5a9120c46c4..72e0b5a6bd5 100644 --- a/rls-analysis/src/analysis.rs +++ b/rls-analysis/src/analysis.rs @@ -12,8 +12,8 @@ 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/loader.rs b/rls-analysis/src/loader.rs index eb9b52c6d14..bff8ef56173 100644 --- a/rls-analysis/src/loader.rs +++ b/rls-analysis/src/loader.rs @@ -17,7 +17,7 @@ use std::fmt; use std::path::{Path, PathBuf}; use std::process::Command; -use AnalysisHost; +use crate::AnalysisHost; #[derive(Debug)] pub struct CargoAnalysisLoader { diff --git a/rls-analysis/src/lowering.rs b/rls-analysis/src/lowering.rs index fed0d8235b4..d182d9595c6 100644 --- a/rls-analysis/src/lowering.rs +++ b/rls-analysis/src/lowering.rs @@ -9,12 +9,12 @@ //! 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..cb6a6110f71 100644 --- a/rls-analysis/src/raw.rs +++ b/rls-analysis/src/raw.rs @@ -12,8 +12,8 @@ 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; diff --git a/rls-analysis/src/test/mod.rs b/rls-analysis/src/test/mod.rs index 5aa68eaab8d..9b370e069f0 100644 --- a/rls-analysis/src/test/mod.rs +++ b/rls-analysis/src/test/mod.rs @@ -6,9 +6,9 @@ // 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}; From 9a8802b407f7a2eee95587d3f0d9c39340f53f68 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 9 Jul 2019 00:40:49 +0200 Subject: [PATCH 4/6] Fix Rust 2018 idioms lint in rls-analysis --- rls-analysis/src/lib.rs | 18 ++++++++---------- rls-analysis/src/loader.rs | 2 +- rls-analysis/src/raw.rs | 4 ++-- rls-analysis/src/symbol_query.rs | 2 +- rls-analysis/src/test/mod.rs | 3 --- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/rls-analysis/src/lib.rs b/rls-analysis/src/lib.rs index 63e9e2727cd..1ba30fe0ead 100644 --- a/rls-analysis/src/lib.rs +++ b/rls-analysis/src/lib.rs @@ -6,17 +6,15 @@ // 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 +134,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 +158,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 +188,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 +549,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 +564,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/loader.rs b/rls-analysis/src/loader.rs index bff8ef56173..7f94af6444f 100644 --- a/rls-analysis/src/loader.rs +++ b/rls-analysis/src/loader.rs @@ -150,7 +150,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/raw.rs b/rls-analysis/src/raw.rs index cb6a6110f71..389617927a4 100644 --- a/rls-analysis/src/raw.rs +++ b/rls-analysis/src/raw.rs @@ -52,7 +52,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 +99,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 9b370e069f0..c0fe7a3316a 100644 --- a/rls-analysis/src/test/mod.rs +++ b/rls-analysis/src/test/mod.rs @@ -13,9 +13,6 @@ 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, From 463b0bdf26d09a0eb384d54c9e492a93b1c8fb63 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 9 Jul 2019 00:45:51 +0200 Subject: [PATCH 5/6] Prune copyright headers --- build.rs | 10 ---------- rls-analysis/benches/std_api_crate.rs | 8 -------- rls-analysis/src/analysis.rs | 8 -------- rls-analysis/src/lib.rs | 8 -------- rls-analysis/src/listings/mod.rs | 8 -------- rls-analysis/src/loader.rs | 8 -------- rls-analysis/src/lowering.rs | 8 -------- rls-analysis/src/raw.rs | 8 -------- rls-analysis/src/test/mod.rs | 8 -------- rls-analysis/src/util.rs | 8 -------- 10 files changed, 82 deletions(-) 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/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 72e0b5a6bd5..4590bcbbcb2 100644 --- a/rls-analysis/src/analysis.rs +++ b/rls-analysis/src/analysis.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. - use fst; use std::collections::{HashMap, HashSet}; use std::iter; diff --git a/rls-analysis/src/lib.rs b/rls-analysis/src/lib.rs index 1ba30fe0ead..84663140d66 100644 --- a/rls-analysis/src/lib.rs +++ b/rls-analysis/src/lib.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. - #![warn(rust_2018_idioms)] #[macro_use] 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 7f94af6444f..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 diff --git a/rls-analysis/src/lowering.rs b/rls-analysis/src/lowering.rs index d182d9595c6..d69254d5c5b 100644 --- a/rls-analysis/src/lowering.rs +++ b/rls-analysis/src/lowering.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. - //! For processing the raw save-analysis data from rustc into the rls //! in-memory representation. diff --git a/rls-analysis/src/raw.rs b/rls-analysis/src/raw.rs index 389617927a4..77996fa3907 100644 --- a/rls-analysis/src/raw.rs +++ b/rls-analysis/src/raw.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 data::config::Config; use data::Analysis; pub use data::{ diff --git a/rls-analysis/src/test/mod.rs b/rls-analysis/src/test/mod.rs index c0fe7a3316a..64a0a8713c1 100644 --- a/rls-analysis/src/test/mod.rs +++ b/rls-analysis/src/test/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 crate::loader::SearchDirectory; use crate::raw::DefKind; use crate::{AnalysisHost, AnalysisLoader}; 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; From f60fb64c073eaaa094397866e6450e028c4b2b88 Mon Sep 17 00:00:00 2001 From: Igor Matuszewski Date: Tue, 9 Jul 2019 00:56:02 +0200 Subject: [PATCH 6/6] Convert rls-vfs to 2018 edition --- rls-vfs/Cargo.toml | 1 + rls-vfs/src/lib.rs | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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())