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

Commit fe46c95

Browse files
authored
Merge pull request #1638 from matthiaskrgr/clippy_5
fix clippy warnings
2 parents bf1d8f9 + c47454d commit fe46c95

File tree

19 files changed

+12
-38
lines changed

19 files changed

+12
-38
lines changed

rls-rustc/src/ipc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ impl From<RpcChannel> for Client {
2323
pub struct IpcFileLoader(FileLoaderClient);
2424

2525
impl IpcFileLoader {
26-
pub fn into_boxed(self) -> Option<Box<dyn syntax::source_map::FileLoader + Send + Sync>> {
26+
pub fn into_boxed(self) -> Option<Box<dyn rustc_span::source_map::FileLoader + Send + Sync>> {
2727
Some(Box::new(self))
2828
}
2929
}
3030

31-
impl syntax::source_map::FileLoader for IpcFileLoader {
31+
impl rustc_span::source_map::FileLoader for IpcFileLoader {
3232
fn file_exists(&self, path: &Path) -> bool {
3333
self.0.file_exists(path.to_owned()).wait().unwrap()
3434
}

rls-rustc/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ impl Callbacks for ShimCalls {
135135
src_path,
136136
disambiguator: sess.local_crate_disambiguator().to_fingerprint().as_value(),
137137
edition: match sess.edition() {
138-
syntax::edition::Edition::Edition2015 => Edition::Edition2015,
139-
syntax::edition::Edition::Edition2018 => Edition::Edition2018,
138+
rustc_span::edition::Edition::Edition2015 => Edition::Edition2015,
139+
rustc_span::edition::Edition::Edition2018 => Edition::Edition2018,
140140
},
141141
};
142142

rls/src/actions/diagnostics.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ use lsp_types::{
1515
};
1616
use rls_span::compiler::DiagnosticSpan;
1717
use serde_derive::Deserialize;
18-
use serde_json;
1918
use url::Url;
2019

2120
pub use lsp_types::Diagnostic;
@@ -598,12 +597,6 @@ help: consider borrowing here: `&string`"#,
598597
assert!(messages[0].1.is_empty(), "{:?}", messages[0].1);
599598
}
600599

601-
/// ```
602-
/// fn main() {
603-
/// let mut out = String::new();
604-
/// write!(out, "{}", 123);
605-
/// }
606-
/// ```
607600
#[test]
608601
fn macro_error_no_trait() {
609602
let diag = parse_compiler_message(

rls/src/actions/format.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use log::debug;
1313
use lsp_types::{Position, Range, TextEdit};
1414
use rand::{distributions, thread_rng, Rng};
1515
use rustfmt_nightly::{Config, Input, ModifiedLines, NewlineStyle, Session};
16-
use serde_json;
1716

1817
/// Specifies which `rustfmt` to use.
1918
#[derive(Clone)]

rls/src/actions/hover.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::path::{Path, PathBuf};
22

3-
use home;
43
use log::*;
5-
use racer;
64
use rls_analysis::{Def, DefKind};
75
use rls_span::{Column, Range, Row, Span, ZeroIndexed};
86
use rls_vfs::{self as vfs, Vfs};

rls/src/actions/requests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,12 @@ use std::sync::atomic::Ordering;
77
use itertools::Itertools;
88
use jsonrpc_core::types::ErrorCode;
99
use log::{debug, trace, warn};
10-
use racer;
1110
use rls_analysis::SymbolQuery;
1211
use rls_data as data;
1312
use rls_span as span;
1413
use rls_vfs::FileContents;
1514
use rustfmt_nightly::{Edition as RustfmtEdition, FileLines, FileName, Range as RustfmtRange};
1615
use serde_derive::{Deserialize, Serialize};
17-
use serde_json;
1816
use url::Url;
1917

2018
use crate::actions::hover;
@@ -269,7 +267,7 @@ impl RequestAction for Completion {
269267
.map(|comp| {
270268
let mut item = completion_item_from_racer_match(&comp);
271269
if is_use_stmt && comp.mtype.is_function() {
272-
item.insert_text = Some(comp.matchstr.to_string());
270+
item.insert_text = Some(comp.matchstr);
273271
} else if code_completion_has_snippet_support {
274272
let snippet = racer::snippet_for_match(&comp, &session);
275273
if !snippet.is_empty() {

rls/src/actions/work_pool.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use crate::server::DEFAULT_REQUEST_TIMEOUT;
22
use lazy_static::lazy_static;
33
use log::{info, warn};
4-
use rayon;
54
use std::sync::{mpsc, Mutex};
65
use std::time::{Duration, Instant};
76
use std::{fmt, panic};

rls/src/build/cargo.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use cargo::util::{
2323
use log::{debug, trace, warn};
2424
use rls_data::Analysis;
2525
use rls_vfs::Vfs;
26-
use serde_json;
2726

2827
use crate::actions::progress::ProgressUpdate;
2928
use crate::build::cargo_plan::CargoPlan;

rls/src/build/cargo_plan.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use cargo::core::compiler::{CompileKind, CompileMode, Context, Unit};
2323
use cargo::core::profiles::Profile;
2424
use cargo::core::{PackageId, Target, TargetKind};
2525
use cargo::util::ProcessBuilder;
26-
use cargo_metadata;
2726
use log::{error, trace};
2827

2928
use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus};

rls/src/build/external.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ impl Invocation {
229229
Invocation {
230230
deps: raw.deps.to_owned(),
231231
outputs: raw.outputs.to_owned(),
232-
links: raw.links.to_owned(),
232+
links: raw.links,
233233
src_path: guess_rustc_src_path(build_dir, &command),
234234
command,
235235
}

rls/src/build/rustc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ impl rustc_driver::Callbacks for RlsRustcCalls {
264264
.and_then(|path| src_path(Some(cwd), path));
265265

266266
let krate = Crate {
267-
name: crate_name.to_owned(),
267+
name: crate_name,
268268
src_path,
269269
disambiguator: sess.local_crate_disambiguator().to_fingerprint().as_value(),
270270
edition: match sess.edition() {

rls/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl Config {
253253
deprecated.push(snake_case.clone());
254254
}
255255

256-
Some((snake_case, JsonValue(v.to_owned().clone())))
256+
Some((snake_case, JsonValue(v.to_owned())))
257257
} else {
258258
None
259259
}

rls/src/lsp_data.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use std::path::PathBuf;
77
pub use lsp_types::notification::Notification as LSPNotification;
88
pub use lsp_types::request::Request as LSPRequest;
99
pub use lsp_types::*;
10-
use racer;
1110
use rls_analysis::DefKind;
1211
use rls_span as span;
1312
use serde_derive::{Deserialize, Serialize};

rls/src/project_model.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use cargo::{
1111
Config,
1212
};
1313
use log::warn;
14-
use racer;
1514
use rls_vfs::{FileContents, Vfs};
1615
use std::{
1716
collections::HashMap,

rls/src/server/io.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
use log::{debug, trace};
2-
use serde;
3-
use serde_json;
42

53
use super::{Notification, Request, RequestId};
64
use crate::lsp_data::{LSPNotification, LSPRequest};

rls/src/server/message.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ use std::time::Instant;
77
use jsonrpc_core::{self as jsonrpc, Id};
88
use log::debug;
99
use lsp_types::notification::ShowMessage;
10-
use serde;
1110
use serde::ser::{Serialize, SerializeStruct, Serializer};
1211
use serde::Deserialize;
1312
use serde_derive::Serialize;
14-
use serde_json;
1513

1614
use crate::actions::{ActionContext, InitActionContext};
1715
use crate::lsp_data::{LSPNotification, LSPRequest, MessageType, ShowMessageParams, WorkspaceEdit};

rls/src/server/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub(crate) fn maybe_notify_duplicated_configs<O: Output>(
132132
}
133133
out.notify(Notification::<ShowMessage>::new(ShowMessageParams {
134134
typ: MessageType::Warning,
135-
message: format!("Duplicated RLS configuration: {}", msg.clone()),
135+
message: format!("Duplicated RLS configuration: {}", msg),
136136
}));
137137
}
138138

tests/client.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,9 +1361,7 @@ fn client_did_change_configuration_duplicated_and_unknown_settings() {
13611361
"dup-licated": "dup-licated"
13621362
}
13631363
});
1364-
rls.notify::<DidChangeConfiguration>(DidChangeConfigurationParams {
1365-
settings: settings.clone(),
1366-
});
1364+
rls.notify::<DidChangeConfiguration>(DidChangeConfigurationParams { settings });
13671365

13681366
rls.wait_for_message(is_notification_for_unknown_config);
13691367
if !rls.messages().iter().any(is_notification_for_duplicated_config) {
@@ -1477,7 +1475,7 @@ fn client_hover_after_src_line_change() {
14771475
let contents = ["&str", "let world = \"world\";"];
14781476
let contents: Vec<_> = contents
14791477
.iter()
1480-
.map(|value| LanguageString { language: "rust".to_string(), value: value.to_string() })
1478+
.map(|value| LanguageString { language: "rust".to_string(), value: (*value).to_string() })
14811479
.map(MarkedString::LanguageString)
14821480
.collect();
14831481

@@ -1914,7 +1912,7 @@ fn client_completion() {
19141912
11,
19151913
CompletionParams {
19161914
text_document_position: TextDocumentPositionParams {
1917-
text_document: text_document.clone(),
1915+
text_document,
19181916
position: Position { line: 15, character: 30 },
19191917
},
19201918
context: None,

tests/support/harness.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ use std::path::{Path, PathBuf};
88
use std::sync::atomic::{AtomicUsize, Ordering};
99
use std::sync::{Arc, Mutex};
1010

11-
use env_logger;
12-
use lsp_types;
1311
use rls::config::{Config, Inferrable};
1412
use rls::server as ls_server;
1513
use rls_analysis::{AnalysisHost, Target};
1614
use rls_vfs::Vfs;
17-
use serde_json;
1815
use walkdir::WalkDir;
1916

2017
use super::fixtures_dir;

0 commit comments

Comments
 (0)