collapsible_if
This commit is contained in:
parent
3409645c3f
commit
b5eca5f2fc
7 changed files with 47 additions and 51 deletions
|
@ -169,7 +169,6 @@ new_ret_no_self = "allow"
|
||||||
## Following lints should be tackled at some point
|
## Following lints should be tackled at some point
|
||||||
borrowed_box = "allow"
|
borrowed_box = "allow"
|
||||||
borrow_deref_ref = "allow"
|
borrow_deref_ref = "allow"
|
||||||
collapsible_if = "allow"
|
|
||||||
collapsible_match = "allow"
|
collapsible_match = "allow"
|
||||||
clone_on_copy = "allow"
|
clone_on_copy = "allow"
|
||||||
derivable_impls = "allow"
|
derivable_impls = "allow"
|
||||||
|
|
|
@ -1842,10 +1842,10 @@ impl Evaluator<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let layout = self.layout(ty);
|
let layout = self.layout(ty);
|
||||||
if self.assert_placeholder_ty_is_unused {
|
if self.assert_placeholder_ty_is_unused
|
||||||
if matches!(layout, Err(MirEvalError::LayoutError(LayoutError::HasPlaceholder, _))) {
|
&& matches!(layout, Err(MirEvalError::LayoutError(LayoutError::HasPlaceholder, _)))
|
||||||
return Ok(Some((0, 1)));
|
{
|
||||||
}
|
return Ok(Some((0, 1)));
|
||||||
}
|
}
|
||||||
let layout = layout?;
|
let layout = layout?;
|
||||||
Ok(layout
|
Ok(layout
|
||||||
|
|
|
@ -948,10 +948,11 @@ impl<'ctx> MirLowerCtx<'ctx> {
|
||||||
// for binary operator, and use without adjust to simplify our conditions.
|
// for binary operator, and use without adjust to simplify our conditions.
|
||||||
let lhs_ty = self.expr_ty_without_adjust(*lhs);
|
let lhs_ty = self.expr_ty_without_adjust(*lhs);
|
||||||
let rhs_ty = self.expr_ty_without_adjust(*rhs);
|
let rhs_ty = self.expr_ty_without_adjust(*rhs);
|
||||||
if matches!(op, BinaryOp::CmpOp(syntax::ast::CmpOp::Eq { .. })) {
|
if matches!(op, BinaryOp::CmpOp(syntax::ast::CmpOp::Eq { .. }))
|
||||||
if lhs_ty.as_raw_ptr().is_some() && rhs_ty.as_raw_ptr().is_some() {
|
&& lhs_ty.as_raw_ptr().is_some()
|
||||||
break 'b true;
|
&& rhs_ty.as_raw_ptr().is_some()
|
||||||
}
|
{
|
||||||
|
break 'b true;
|
||||||
}
|
}
|
||||||
let builtin_inequal_impls = matches!(
|
let builtin_inequal_impls = matches!(
|
||||||
op,
|
op,
|
||||||
|
|
|
@ -377,10 +377,8 @@ fn build_source_change(
|
||||||
};
|
};
|
||||||
|
|
||||||
// Insert `$0` only for last getter we generate
|
// Insert `$0` only for last getter we generate
|
||||||
if i == record_fields_count - 1 {
|
if i == record_fields_count - 1 && ctx.config.snippet_cap.is_some() {
|
||||||
if ctx.config.snippet_cap.is_some() {
|
getter_buf = getter_buf.replacen("fn ", "fn $0", 1);
|
||||||
getter_buf = getter_buf.replacen("fn ", "fn $0", 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For first element we do not merge with '\n', as
|
// For first element we do not merge with '\n', as
|
||||||
|
|
|
@ -310,22 +310,20 @@ fn completion_item(
|
||||||
|
|
||||||
set_score(&mut lsp_item, max_relevance, item.relevance);
|
set_score(&mut lsp_item, max_relevance, item.relevance);
|
||||||
|
|
||||||
if config.completion().enable_imports_on_the_fly {
|
if config.completion().enable_imports_on_the_fly && !item.import_to_add.is_empty() {
|
||||||
if !item.import_to_add.is_empty() {
|
let imports: Vec<_> = item
|
||||||
let imports: Vec<_> = item
|
.import_to_add
|
||||||
.import_to_add
|
.into_iter()
|
||||||
.into_iter()
|
.filter_map(|(import_path, import_name)| {
|
||||||
.filter_map(|(import_path, import_name)| {
|
Some(lsp_ext::CompletionImport {
|
||||||
Some(lsp_ext::CompletionImport {
|
full_import_path: import_path,
|
||||||
full_import_path: import_path,
|
imported_name: import_name,
|
||||||
imported_name: import_name,
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
.collect();
|
})
|
||||||
if !imports.is_empty() {
|
.collect();
|
||||||
let data = lsp_ext::CompletionResolveData { position: tdpp.clone(), imports };
|
if !imports.is_empty() {
|
||||||
lsp_item.data = Some(to_value(data).unwrap());
|
let data = lsp_ext::CompletionResolveData { position: tdpp.clone(), imports };
|
||||||
}
|
lsp_item.data = Some(to_value(data).unwrap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -579,10 +579,10 @@ impl GlobalState {
|
||||||
let path = VfsPath::from(path);
|
let path = VfsPath::from(path);
|
||||||
// if the file is in mem docs, it's managed by the client via notifications
|
// if the file is in mem docs, it's managed by the client via notifications
|
||||||
// so only set it if its not in there
|
// so only set it if its not in there
|
||||||
if !self.mem_docs.contains(&path) {
|
if !self.mem_docs.contains(&path)
|
||||||
if is_changed || vfs.file_id(&path).is_none() {
|
&& (is_changed || vfs.file_id(&path).is_none())
|
||||||
vfs.set_file_contents(path, contents);
|
{
|
||||||
}
|
vfs.set_file_contents(path, contents);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -454,27 +454,27 @@ impl GlobalState {
|
||||||
let files_config = self.config.files();
|
let files_config = self.config.files();
|
||||||
let project_folders = ProjectFolders::new(&self.workspaces, &files_config.exclude);
|
let project_folders = ProjectFolders::new(&self.workspaces, &files_config.exclude);
|
||||||
|
|
||||||
if self.proc_macro_clients.is_empty() || !same_workspaces {
|
if (self.proc_macro_clients.is_empty() || !same_workspaces)
|
||||||
if self.config.expand_proc_macros() {
|
&& self.config.expand_proc_macros()
|
||||||
tracing::info!("Spawning proc-macro servers");
|
{
|
||||||
|
tracing::info!("Spawning proc-macro servers");
|
||||||
|
|
||||||
self.proc_macro_clients = Arc::from_iter(self.workspaces.iter().map(|ws| {
|
self.proc_macro_clients = Arc::from_iter(self.workspaces.iter().map(|ws| {
|
||||||
let path = match self.config.proc_macro_srv() {
|
let path = match self.config.proc_macro_srv() {
|
||||||
Some(path) => path,
|
Some(path) => path,
|
||||||
None => ws.find_sysroot_proc_macro_srv()?,
|
None => ws.find_sysroot_proc_macro_srv()?,
|
||||||
};
|
};
|
||||||
|
|
||||||
tracing::info!("Using proc-macro server at {path}");
|
tracing::info!("Using proc-macro server at {path}");
|
||||||
ProcMacroServer::spawn(path.clone()).map_err(|err| {
|
ProcMacroServer::spawn(path.clone()).map_err(|err| {
|
||||||
tracing::error!(
|
tracing::error!(
|
||||||
"Failed to run proc-macro server from path {path}, error: {err:?}",
|
"Failed to run proc-macro server from path {path}, error: {err:?}",
|
||||||
);
|
);
|
||||||
anyhow::format_err!(
|
anyhow::format_err!(
|
||||||
"Failed to run proc-macro server from path {path}, error: {err:?}",
|
"Failed to run proc-macro server from path {path}, error: {err:?}",
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}))
|
}))
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let watch = match files_config.watcher {
|
let watch = match files_config.watcher {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue