Merge #251
251: Clippy lints r=matklad a=kjeremy Co-authored-by: Jeremy A. Kolb <jkolb@ara.com>
This commit is contained in:
commit
714f6afb32
@ -94,7 +94,7 @@ impl RawRequest {
|
||||
R::Params: Serialize,
|
||||
{
|
||||
RawRequest {
|
||||
id: id,
|
||||
id,
|
||||
method: R::METHOD.to_string(),
|
||||
params: to_value(params).unwrap(),
|
||||
}
|
||||
|
@ -63,10 +63,7 @@ impl ConvWith for TextUnit {
|
||||
|
||||
fn conv_with(self, line_index: &LineIndex) -> Position {
|
||||
let line_col = line_index.line_col(self);
|
||||
Position::new(
|
||||
u64::from(line_col.line),
|
||||
u64::from(u32::from(line_col.col_utf16)),
|
||||
)
|
||||
Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16))
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,10 +201,8 @@ impl TryConvWith for SourceChange {
|
||||
.map(|it| it.edits.as_slice())
|
||||
.unwrap_or(&[]);
|
||||
let line_col = translate_offset_with_edit(&*line_index, pos.offset, edits);
|
||||
let position = Position::new(
|
||||
u64::from(line_col.line),
|
||||
u64::from(u32::from(line_col.col_utf16)),
|
||||
);
|
||||
let position =
|
||||
Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16));
|
||||
Some(TextDocumentPositionParams {
|
||||
text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?),
|
||||
position,
|
||||
|
@ -2,7 +2,6 @@
|
||||
extern crate log;
|
||||
#[macro_use]
|
||||
extern crate failure;
|
||||
#[macro_use]
|
||||
extern crate serde_derive;
|
||||
extern crate serde;
|
||||
extern crate flexi_logger;
|
||||
|
@ -384,7 +384,7 @@ pub fn handle_completion(
|
||||
let completion_triggered_after_single_colon = {
|
||||
let mut res = false;
|
||||
if let Some(ctx) = params.context {
|
||||
if ctx.trigger_character.unwrap_or(String::new()) == ":" {
|
||||
if ctx.trigger_character.unwrap_or_default() == ":" {
|
||||
let source_file = world.analysis().file_syntax(position.file_id);
|
||||
let syntax = source_file.syntax();
|
||||
let text = syntax.text();
|
||||
@ -567,10 +567,13 @@ pub fn handle_rename(world: ServerWorld, params: RenameParams) -> Result<Option<
|
||||
let mut changes = HashMap::new();
|
||||
for r in refs {
|
||||
if let Ok(loc) = to_location(r.0, r.1, &world, &line_index) {
|
||||
changes.entry(loc.uri).or_insert(Vec::new()).push(TextEdit {
|
||||
range: loc.range,
|
||||
new_text: params.new_name.clone(),
|
||||
});
|
||||
changes
|
||||
.entry(loc.uri)
|
||||
.or_insert_with(Vec::new)
|
||||
.push(TextEdit {
|
||||
range: loc.range,
|
||||
new_text: params.new_name.clone(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ impl PathMap {
|
||||
(inserted, file_id)
|
||||
}
|
||||
pub fn get_id(&self, path: &Path) -> Option<FileId> {
|
||||
self.path2id.get(path).map(|&id| id)
|
||||
self.path2id.get(path).cloned()
|
||||
}
|
||||
pub fn get_path(&self, file_id: FileId) -> &Path {
|
||||
self.id2path.get(&file_id).unwrap().as_path()
|
||||
|
Loading…
x
Reference in New Issue
Block a user