mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 04:23:25 +00:00
internal: remove dead code
This commit is contained in:
parent
726a2aa211
commit
73b0f9dc04
10 changed files with 10 additions and 43 deletions
|
@ -55,7 +55,7 @@ impl fmt::Display for FlycheckConfig {
|
||||||
pub struct FlycheckHandle {
|
pub struct FlycheckHandle {
|
||||||
// XXX: drop order is significant
|
// XXX: drop order is significant
|
||||||
sender: Sender<Restart>,
|
sender: Sender<Restart>,
|
||||||
thread: jod_thread::JoinHandle,
|
_thread: jod_thread::JoinHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlycheckHandle {
|
impl FlycheckHandle {
|
||||||
|
@ -71,7 +71,7 @@ impl FlycheckHandle {
|
||||||
.name("Flycheck".to_owned())
|
.name("Flycheck".to_owned())
|
||||||
.spawn(move || actor.run(receiver))
|
.spawn(move || actor.run(receiver))
|
||||||
.expect("failed to spawn thread");
|
.expect("failed to spawn thread");
|
||||||
FlycheckHandle { sender, thread }
|
FlycheckHandle { sender, _thread: thread }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Schedule a re-start of the cargo check worker.
|
/// Schedule a re-start of the cargo check worker.
|
||||||
|
|
|
@ -43,7 +43,6 @@ pub(crate) struct SourceAnalyzer {
|
||||||
body: Option<Arc<Body>>,
|
body: Option<Arc<Body>>,
|
||||||
body_source_map: Option<Arc<BodySourceMap>>,
|
body_source_map: Option<Arc<BodySourceMap>>,
|
||||||
infer: Option<Arc<InferenceResult>>,
|
infer: Option<Arc<InferenceResult>>,
|
||||||
scopes: Option<Arc<ExprScopes>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SourceAnalyzer {
|
impl SourceAnalyzer {
|
||||||
|
@ -65,7 +64,6 @@ impl SourceAnalyzer {
|
||||||
body: Some(body),
|
body: Some(body),
|
||||||
body_source_map: Some(source_map),
|
body_source_map: Some(source_map),
|
||||||
infer: Some(db.infer(def)),
|
infer: Some(db.infer(def)),
|
||||||
scopes: Some(scopes),
|
|
||||||
file_id: node.file_id,
|
file_id: node.file_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +77,6 @@ impl SourceAnalyzer {
|
||||||
body: None,
|
body: None,
|
||||||
body_source_map: None,
|
body_source_map: None,
|
||||||
infer: None,
|
infer: None,
|
||||||
scopes: None,
|
|
||||||
file_id: node.file_id,
|
file_id: node.file_id,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,6 @@ pub(crate) struct CompletionContext<'a> {
|
||||||
|
|
||||||
pub(super) pattern_ctx: Option<PatternContext>,
|
pub(super) pattern_ctx: Option<PatternContext>,
|
||||||
pub(super) path_context: Option<PathCompletionContext>,
|
pub(super) path_context: Option<PathCompletionContext>,
|
||||||
pub(super) active_parameter: Option<ActiveParameter>,
|
|
||||||
pub(super) locals: Vec<(String, Local)>,
|
pub(super) locals: Vec<(String, Local)>,
|
||||||
|
|
||||||
pub(super) incomplete_let: bool,
|
pub(super) incomplete_let: bool,
|
||||||
|
@ -170,7 +169,6 @@ impl<'a> CompletionContext<'a> {
|
||||||
attribute_under_caret: None,
|
attribute_under_caret: None,
|
||||||
previous_token: None,
|
previous_token: None,
|
||||||
path_context: None,
|
path_context: None,
|
||||||
active_parameter: ActiveParameter::at(db, position),
|
|
||||||
locals,
|
locals,
|
||||||
incomplete_let: false,
|
incomplete_let: false,
|
||||||
no_completion_required: false,
|
no_completion_required: false,
|
||||||
|
|
|
@ -26,7 +26,6 @@ pub(crate) fn render_variant(
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
struct EnumRender<'a> {
|
struct EnumRender<'a> {
|
||||||
ctx: RenderContext<'a>,
|
ctx: RenderContext<'a>,
|
||||||
name: hir::Name,
|
|
||||||
variant: hir::Variant,
|
variant: hir::Variant,
|
||||||
path: Option<hir::ModPath>,
|
path: Option<hir::ModPath>,
|
||||||
qualified_name: hir::ModPath,
|
qualified_name: hir::ModPath,
|
||||||
|
@ -58,7 +57,7 @@ impl<'a> EnumRender<'a> {
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
EnumRender { ctx, name, variant, path, qualified_name, short_qualified_name, variant_kind }
|
EnumRender { ctx, variant, path, qualified_name, short_qualified_name, variant_kind }
|
||||||
}
|
}
|
||||||
fn render(self, import_to_add: Option<ImportEdit>) -> CompletionItem {
|
fn render(self, import_to_add: Option<ImportEdit>) -> CompletionItem {
|
||||||
let mut item = CompletionItem::new(
|
let mut item = CompletionItem::new(
|
||||||
|
|
|
@ -154,15 +154,6 @@ pub struct ActiveParameter {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ActiveParameter {
|
impl ActiveParameter {
|
||||||
pub fn at(db: &RootDatabase, position: FilePosition) -> Option<Self> {
|
|
||||||
let sema = Semantics::new(db);
|
|
||||||
let file = sema.parse(position.file_id);
|
|
||||||
let file = file.syntax();
|
|
||||||
let token = file.token_at_offset(position.offset).next()?;
|
|
||||||
let token = sema.descend_into_macros(token);
|
|
||||||
Self::at_token(&sema, token)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn at_token(sema: &Semantics<RootDatabase>, token: SyntaxToken) -> Option<Self> {
|
pub fn at_token(sema: &Semantics<RootDatabase>, token: SyntaxToken) -> Option<Self> {
|
||||||
let (signature, active_parameter) = call_info_impl(sema, token)?;
|
let (signature, active_parameter) = call_info_impl(sema, token)?;
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,6 @@ pub struct SsrRule {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct SsrPattern {
|
pub struct SsrPattern {
|
||||||
raw: parsing::RawPattern,
|
|
||||||
parsed_rules: Vec<parsing::ParsedRule>,
|
parsed_rules: Vec<parsing::ParsedRule>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,6 @@ pub struct Match {
|
||||||
/// Information about a placeholder bound in a match.
|
/// Information about a placeholder bound in a match.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct PlaceholderMatch {
|
pub(crate) struct PlaceholderMatch {
|
||||||
/// The node that the placeholder matched to. If set, then we'll search for further matches
|
|
||||||
/// within this node. It isn't set when we match tokens within a macro call's token tree.
|
|
||||||
pub(crate) node: Option<SyntaxNode>,
|
|
||||||
pub(crate) range: FileRange,
|
pub(crate) range: FileRange,
|
||||||
/// More matches, found within `node`.
|
/// More matches, found within `node`.
|
||||||
pub(crate) inner_matches: SsrMatches,
|
pub(crate) inner_matches: SsrMatches,
|
||||||
|
@ -186,7 +183,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
|
||||||
self.validate_range(&original_range)?;
|
self.validate_range(&original_range)?;
|
||||||
matches_out.placeholder_values.insert(
|
matches_out.placeholder_values.insert(
|
||||||
placeholder.ident.clone(),
|
placeholder.ident.clone(),
|
||||||
PlaceholderMatch::new(Some(code), original_range),
|
PlaceholderMatch::from_range(original_range),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
|
@ -715,19 +712,14 @@ fn recording_match_fail_reasons() -> bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PlaceholderMatch {
|
impl PlaceholderMatch {
|
||||||
fn new(node: Option<&SyntaxNode>, range: FileRange) -> Self {
|
fn from_range(range: FileRange) -> Self {
|
||||||
Self {
|
Self {
|
||||||
node: node.cloned(),
|
|
||||||
range,
|
range,
|
||||||
inner_matches: SsrMatches::default(),
|
inner_matches: SsrMatches::default(),
|
||||||
autoderef_count: 0,
|
autoderef_count: 0,
|
||||||
autoref_kind: ast::SelfParamKind::Owned,
|
autoref_kind: ast::SelfParamKind::Owned,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_range(range: FileRange) -> Self {
|
|
||||||
Self::new(None, range)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NodeKind {
|
impl NodeKind {
|
||||||
|
@ -788,7 +780,6 @@ impl PatternIterator {
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
|
||||||
use crate::{MatchFinder, SsrRule};
|
use crate::{MatchFinder, SsrRule};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -803,14 +794,6 @@ mod tests {
|
||||||
assert_eq!(matches.matches.len(), 1);
|
assert_eq!(matches.matches.len(), 1);
|
||||||
assert_eq!(matches.matches[0].matched_node.text(), "foo(1+2)");
|
assert_eq!(matches.matches[0].matched_node.text(), "foo(1+2)");
|
||||||
assert_eq!(matches.matches[0].placeholder_values.len(), 1);
|
assert_eq!(matches.matches[0].placeholder_values.len(), 1);
|
||||||
assert_eq!(
|
|
||||||
matches.matches[0].placeholder_values[&Var("x".to_string())]
|
|
||||||
.node
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.text(),
|
|
||||||
"1+2"
|
|
||||||
);
|
|
||||||
|
|
||||||
let edits = match_finder.edits();
|
let edits = match_finder.edits();
|
||||||
assert_eq!(edits.len(), 1);
|
assert_eq!(edits.len(), 1);
|
||||||
|
|
|
@ -204,7 +204,7 @@ impl FromStr for SsrPattern {
|
||||||
fn from_str(pattern_str: &str) -> Result<SsrPattern, SsrError> {
|
fn from_str(pattern_str: &str) -> Result<SsrPattern, SsrError> {
|
||||||
let raw_pattern = pattern_str.parse()?;
|
let raw_pattern = pattern_str.parse()?;
|
||||||
let parsed_rules = ParsedRule::new(&raw_pattern, None)?;
|
let parsed_rules = ParsedRule::new(&raw_pattern, None)?;
|
||||||
Ok(SsrPattern { raw: raw_pattern, parsed_rules })
|
Ok(SsrPattern { parsed_rules })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use crate::{
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub(crate) struct ProcMacroProcessSrv {
|
pub(crate) struct ProcMacroProcessSrv {
|
||||||
process: Process,
|
_process: Process,
|
||||||
stdin: ChildStdin,
|
stdin: ChildStdin,
|
||||||
stdout: BufReader<ChildStdout>,
|
stdout: BufReader<ChildStdout>,
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ impl ProcMacroProcessSrv {
|
||||||
let mut process = Process::run(process_path, args)?;
|
let mut process = Process::run(process_path, args)?;
|
||||||
let (stdin, stdout) = process.stdio().expect("couldn't access child stdio");
|
let (stdin, stdout) = process.stdio().expect("couldn't access child stdio");
|
||||||
|
|
||||||
let srv = ProcMacroProcessSrv { process, stdin, stdout };
|
let srv = ProcMacroProcessSrv { _process: process, stdin, stdout };
|
||||||
|
|
||||||
Ok(srv)
|
Ok(srv)
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ use walkdir::WalkDir;
|
||||||
pub struct NotifyHandle {
|
pub struct NotifyHandle {
|
||||||
// Relative order of fields below is significant.
|
// Relative order of fields below is significant.
|
||||||
sender: Sender<Message>,
|
sender: Sender<Message>,
|
||||||
thread: jod_thread::JoinHandle,
|
_thread: jod_thread::JoinHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -35,7 +35,7 @@ impl loader::Handle for NotifyHandle {
|
||||||
.name("VfsLoader".to_owned())
|
.name("VfsLoader".to_owned())
|
||||||
.spawn(move || actor.run(receiver))
|
.spawn(move || actor.run(receiver))
|
||||||
.expect("failed to spawn thread");
|
.expect("failed to spawn thread");
|
||||||
NotifyHandle { sender, thread }
|
NotifyHandle { sender, _thread: thread }
|
||||||
}
|
}
|
||||||
fn set_config(&mut self, config: loader::Config) {
|
fn set_config(&mut self, config: loader::Config) {
|
||||||
self.sender.send(Message::Config(config)).unwrap()
|
self.sender.send(Message::Config(config)).unwrap()
|
||||||
|
|
Loading…
Reference in a new issue