Skip to content
This repository was archived by the owner on Dec 29, 2022. It is now read-only.

Commit da01448

Browse files
authored
Merge pull request #1507 from Xanewok/summer-cleaning
Summer cleaning
2 parents 124483d + f60fb64 commit da01448

File tree

17 files changed

+31
-114
lines changed

17 files changed

+31
-114
lines changed

build.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT
2-
// file at the top-level directory of this distribution and at
3-
// http://rust-lang.org/COPYRIGHT.
4-
//
5-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8-
// option. This file may not be copied, modified, or distributed
9-
// except according to those terms.
10-
111
use std::env;
122
use std::path::Path;
133

rls-analysis/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[package]
22
name = "rls-analysis"
33
version = "0.17.0"
4+
edition = "2018"
45
authors = ["Nick Cameron <[email protected]>"]
56
description = "Library for processing rustc's save-analysis data for the RLS"
67
license = "Apache-2.0/MIT"

rls-analysis/benches/std_api_crate.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Copyright 2017 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
8-
91
#![feature(test)]
102

113
extern crate rls_analysis;

rls-analysis/src/analysis.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
// Copyright 2017 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
8-
91
use fst;
102
use std::collections::{HashMap, HashSet};
113
use std::iter;
124
use std::path::{Path, PathBuf};
135
use std::time::SystemTime;
146

15-
use raw::{CrateId, DefKind};
16-
use {Id, Span, SymbolQuery};
7+
use crate::raw::{CrateId, DefKind};
8+
use crate::{Id, Span, SymbolQuery};
179

1810
/// This is the main database that contains all the collected symbol information,
1911
/// such as definitions, their mapping between spans, hierarchy and so on,

rls-analysis/src/lib.rs

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
1-
// Copyright 2016 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
1+
#![warn(rust_2018_idioms)]
82

93
#[macro_use]
104
extern crate derive_new;
115
#[macro_use]
126
extern crate log;
13-
extern crate fst;
14-
extern crate itertools;
15-
extern crate json;
7+
168
extern crate rls_data as data;
179
extern crate rls_span as span;
18-
extern crate serde;
19-
extern crate serde_json;
2010

2111
mod analysis;
2212
mod listings;
@@ -136,7 +126,7 @@ impl<L: AnalysisLoader> AnalysisHost<L> {
136126
analysis: Vec<data::Analysis>,
137127
path_prefix: &Path,
138128
base_dir: &Path,
139-
blacklist: Blacklist,
129+
blacklist: Blacklist<'_>,
140130
) -> AResult<()> {
141131
self.reload_with_blacklist(path_prefix, base_dir, blacklist)?;
142132

@@ -160,7 +150,7 @@ impl<L: AnalysisLoader> AnalysisHost<L> {
160150
&self,
161151
path_prefix: &Path,
162152
base_dir: &Path,
163-
blacklist: Blacklist,
153+
blacklist: Blacklist<'_>,
164154
) -> AResult<()> {
165155
trace!("reload_with_blacklist {:?} {:?} {:?}", path_prefix, base_dir, blacklist);
166156
let empty = self.analysis.lock()?.is_none();
@@ -190,7 +180,7 @@ impl<L: AnalysisLoader> AnalysisHost<L> {
190180
&self,
191181
path_prefix: &Path,
192182
base_dir: &Path,
193-
blacklist: Blacklist,
183+
blacklist: Blacklist<'_>,
194184
) -> AResult<()> {
195185
trace!("hard_reload {:?} {:?}", path_prefix, base_dir);
196186
// We're going to create a dummy AnalysisHost that we will fill with data,
@@ -551,7 +541,7 @@ impl<L: AnalysisLoader> AnalysisHost<L> {
551541
}
552542

553543
impl ::std::fmt::Display for Id {
554-
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
544+
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
555545
self.0.fmt(f)
556546
}
557547
}
@@ -566,7 +556,7 @@ impl ::std::error::Error for AError {
566556
}
567557

568558
impl ::std::fmt::Display for AError {
569-
fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
559+
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
570560
write!(f, "{}", ::std::error::Error::description(self))
571561
}
572562
}

rls-analysis/src/listings/mod.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Copyright 2016 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
8-
91
use std::io;
102
use std::path::Path;
113
use std::time::SystemTime;

rls-analysis/src/loader.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
// Copyright 2017 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
8-
91
//! Defines an `AnalysisLoader` trait, which allows to specify directories
102
//! from which save-analysis JSON files can be read. Also supplies a
113
//! default implementation `CargoAnalysisLoader` for Cargo-emitted save-analysis
@@ -17,7 +9,7 @@ use std::fmt;
179
use std::path::{Path, PathBuf};
1810
use std::process::Command;
1911

20-
use AnalysisHost;
12+
use crate::AnalysisHost;
2113

2214
#[derive(Debug)]
2315
pub struct CargoAnalysisLoader {
@@ -150,7 +142,7 @@ pub enum Target {
150142
}
151143

152144
impl fmt::Display for Target {
153-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
145+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
154146
match *self {
155147
Target::Release => write!(f, "release"),
156148
Target::Debug => write!(f, "debug"),

rls-analysis/src/lowering.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,12 @@
1-
// Copyright 2016 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
8-
91
//! For processing the raw save-analysis data from rustc into the rls
102
//! in-memory representation.
113
12-
use analysis::{Def, Glob, PerCrateAnalysis, Ref};
4+
use crate::analysis::{Def, Glob, PerCrateAnalysis, Ref};
135
use data;
14-
use loader::AnalysisLoader;
15-
use raw::{self, CrateId, DefKind, RelationKind};
16-
use util;
17-
use {AResult, AnalysisHost, Id, Span, NULL};
6+
use crate::loader::AnalysisLoader;
7+
use crate::raw::{self, CrateId, DefKind, RelationKind};
8+
use crate::util;
9+
use crate::{AResult, AnalysisHost, Id, Span, NULL};
1810

1911
use span;
2012

rls-analysis/src/raw.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,11 @@
1-
// Copyright 2016 The RLS Project Developers.
2-
//
3-
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4-
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5-
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
6-
// option. This file may not be copied, modified, or distributed
7-
// except according to those terms.
8-
91
use data::config::Config;
102
use data::Analysis;
113
pub use data::{
124
CratePreludeData, Def, DefKind, GlobalCrateId as CrateId, Import, Ref, Relation, RelationKind,
135
SigElement, Signature, SpanData,
146
};
15-
use listings::{DirectoryListing, ListingKind};
16-
use {AnalysisLoader, Blacklist};
7+
use crate::listings::{DirectoryListing, ListingKind};
8+
use crate::{AnalysisLoader, Blacklist};
179

1810
use std::collections::HashMap;
1911
use std::fs::File;
@@ -52,7 +44,7 @@ impl Crate {
5244
pub fn read_analysis_from_files<L: AnalysisLoader>(
5345
loader: &L,
5446
crate_timestamps: HashMap<PathBuf, SystemTime>,
55-
crate_blacklist: Blacklist,
47+
crate_blacklist: Blacklist<'_>,
5648
) -> Vec<Crate> {
5749
let mut result = vec![];
5850

@@ -99,7 +91,7 @@ pub fn read_analysis_from_files<L: AnalysisLoader>(
9991
result
10092
}
10193

102-
fn ignore_data(file_name: &str, crate_blacklist: Blacklist) -> bool {
94+
fn ignore_data(file_name: &str, crate_blacklist: Blacklist<'_>) -> bool {
10395
crate_blacklist.iter().any(|name| file_name.starts_with(&format!("lib{}-", name)))
10496
}
10597

rls-analysis/src/symbol_query.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ impl SymbolQuery {
5757
stream.union()
5858
}
5959

60-
pub(crate) fn search_stream<F, T>(&self, mut stream: fst::map::Union, f: F) -> Vec<T>
60+
pub(crate) fn search_stream<F, T>(&self, mut stream: fst::map::Union<'_>, f: F) -> Vec<T>
6161
where
6262
F: Fn(&mut Vec<T>, &fst::map::IndexedValue),
6363
{

0 commit comments

Comments
 (0)