1
Fork 0

collapsible_if

This commit is contained in:
Johann Hemmann 2024-01-19 13:22:32 +01:00
parent 3409645c3f
commit b5eca5f2fc
7 changed files with 47 additions and 51 deletions

View file

@ -169,7 +169,6 @@ new_ret_no_self = "allow"
## Following lints should be tackled at some point
borrowed_box = "allow"
borrow_deref_ref = "allow"
collapsible_if = "allow"
collapsible_match = "allow"
clone_on_copy = "allow"
derivable_impls = "allow"

View file

@ -1842,11 +1842,11 @@ impl Evaluator<'_> {
}
}
let layout = self.layout(ty);
if self.assert_placeholder_ty_is_unused {
if matches!(layout, Err(MirEvalError::LayoutError(LayoutError::HasPlaceholder, _))) {
if self.assert_placeholder_ty_is_unused
&& matches!(layout, Err(MirEvalError::LayoutError(LayoutError::HasPlaceholder, _)))
{
return Ok(Some((0, 1)));
}
}
let layout = layout?;
Ok(layout
.is_sized()

View file

@ -948,11 +948,12 @@ impl<'ctx> MirLowerCtx<'ctx> {
// for binary operator, and use without adjust to simplify our conditions.
let lhs_ty = self.expr_ty_without_adjust(*lhs);
let rhs_ty = self.expr_ty_without_adjust(*rhs);
if matches!(op, BinaryOp::CmpOp(syntax::ast::CmpOp::Eq { .. })) {
if lhs_ty.as_raw_ptr().is_some() && rhs_ty.as_raw_ptr().is_some() {
if matches!(op, BinaryOp::CmpOp(syntax::ast::CmpOp::Eq { .. }))
&& lhs_ty.as_raw_ptr().is_some()
&& rhs_ty.as_raw_ptr().is_some()
{
break 'b true;
}
}
let builtin_inequal_impls = matches!(
op,
BinaryOp::ArithOp(ArithOp::Shl | ArithOp::Shr)

View file

@ -377,11 +377,9 @@ fn build_source_change(
};
// Insert `$0` only for last getter we generate
if i == record_fields_count - 1 {
if ctx.config.snippet_cap.is_some() {
if i == record_fields_count - 1 && ctx.config.snippet_cap.is_some() {
getter_buf = getter_buf.replacen("fn ", "fn $0", 1);
}
}
// For first element we do not merge with '\n', as
// that can be inserted by impl_def check defined

View file

@ -310,8 +310,7 @@ fn completion_item(
set_score(&mut lsp_item, max_relevance, item.relevance);
if config.completion().enable_imports_on_the_fly {
if !item.import_to_add.is_empty() {
if config.completion().enable_imports_on_the_fly && !item.import_to_add.is_empty() {
let imports: Vec<_> = item
.import_to_add
.into_iter()
@ -327,7 +326,6 @@ fn completion_item(
lsp_item.data = Some(to_value(data).unwrap());
}
}
}
if let Some((label, indel, relevance)) = ref_match {
let mut lsp_item_with_ref = lsp_types::CompletionItem { label, ..lsp_item.clone() };

View file

@ -579,13 +579,13 @@ impl GlobalState {
let path = VfsPath::from(path);
// if the file is in mem docs, it's managed by the client via notifications
// so only set it if its not in there
if !self.mem_docs.contains(&path) {
if is_changed || vfs.file_id(&path).is_none() {
if !self.mem_docs.contains(&path)
&& (is_changed || vfs.file_id(&path).is_none())
{
vfs.set_file_contents(path, contents);
}
}
}
}
vfs::loader::Message::Progress { n_total, n_done, dir, config_version } => {
always!(config_version <= self.vfs_config_version);

View file

@ -454,8 +454,9 @@ impl GlobalState {
let files_config = self.config.files();
let project_folders = ProjectFolders::new(&self.workspaces, &files_config.exclude);
if self.proc_macro_clients.is_empty() || !same_workspaces {
if self.config.expand_proc_macros() {
if (self.proc_macro_clients.is_empty() || !same_workspaces)
&& self.config.expand_proc_macros()
{
tracing::info!("Spawning proc-macro servers");
self.proc_macro_clients = Arc::from_iter(self.workspaces.iter().map(|ws| {
@ -474,7 +475,6 @@ impl GlobalState {
)
})
}))
};
}
let watch = match files_config.watcher {