Enforce style lints which do not have violations (#36580)
Release Notes: - N/A
This commit is contained in:
parent
4ee565cd39
commit
6ed29fbc34
20 changed files with 146 additions and 89 deletions
96
Cargo.toml
96
Cargo.toml
|
@ -825,36 +825,106 @@ declare_interior_mutable_const = "deny"
|
||||||
style = { level = "allow", priority = -1 }
|
style = { level = "allow", priority = -1 }
|
||||||
|
|
||||||
# Temporary list of style lints that we've fixed so far.
|
# Temporary list of style lints that we've fixed so far.
|
||||||
|
# Progress is being tracked in #36577
|
||||||
|
blocks_in_conditions = "warn"
|
||||||
bool_assert_comparison = "warn"
|
bool_assert_comparison = "warn"
|
||||||
|
borrow_interior_mutable_const = "warn"
|
||||||
|
box_default = "warn"
|
||||||
|
builtin_type_shadow = "warn"
|
||||||
|
bytes_nth = "warn"
|
||||||
|
chars_next_cmp = "warn"
|
||||||
|
cmp_null = "warn"
|
||||||
|
collapsible_else_if = "warn"
|
||||||
|
collapsible_if = "warn"
|
||||||
comparison_to_empty = "warn"
|
comparison_to_empty = "warn"
|
||||||
|
default_instead_of_iter_empty = "warn"
|
||||||
|
disallowed_macros = "warn"
|
||||||
|
disallowed_methods = "warn"
|
||||||
|
disallowed_names = "warn"
|
||||||
|
disallowed_types = "warn"
|
||||||
doc_lazy_continuation = "warn"
|
doc_lazy_continuation = "warn"
|
||||||
doc_overindented_list_items = "warn"
|
doc_overindented_list_items = "warn"
|
||||||
inherent_to_string = "warn"
|
duplicate_underscore_argument = "warn"
|
||||||
|
err_expect = "warn"
|
||||||
|
fn_to_numeric_cast = "warn"
|
||||||
|
fn_to_numeric_cast_with_truncation = "warn"
|
||||||
for_kv_map = "warn"
|
for_kv_map = "warn"
|
||||||
|
implicit_saturating_add = "warn"
|
||||||
|
implicit_saturating_sub = "warn"
|
||||||
|
inconsistent_digit_grouping = "warn"
|
||||||
|
infallible_destructuring_match = "warn"
|
||||||
|
inherent_to_string = "warn"
|
||||||
|
init_numbered_fields = "warn"
|
||||||
into_iter_on_ref = "warn"
|
into_iter_on_ref = "warn"
|
||||||
io_other_error = "warn"
|
io_other_error = "warn"
|
||||||
|
items_after_test_module = "warn"
|
||||||
iter_cloned_collect = "warn"
|
iter_cloned_collect = "warn"
|
||||||
iter_next_slice = "warn"
|
iter_next_slice = "warn"
|
||||||
iter_nth = "warn"
|
iter_nth = "warn"
|
||||||
iter_nth_zero = "warn"
|
iter_nth_zero = "warn"
|
||||||
iter_skip_next = "warn"
|
iter_skip_next = "warn"
|
||||||
|
just_underscores_and_digits = "warn"
|
||||||
let_and_return = "warn"
|
let_and_return = "warn"
|
||||||
|
main_recursion = "warn"
|
||||||
|
manual_bits = "warn"
|
||||||
|
manual_dangling_ptr = "warn"
|
||||||
|
manual_is_ascii_check = "warn"
|
||||||
|
manual_is_finite = "warn"
|
||||||
|
manual_is_infinite = "warn"
|
||||||
|
manual_next_back = "warn"
|
||||||
|
manual_non_exhaustive = "warn"
|
||||||
|
manual_ok_or = "warn"
|
||||||
|
manual_pattern_char_comparison = "warn"
|
||||||
|
manual_rotate = "warn"
|
||||||
|
manual_slice_fill = "warn"
|
||||||
|
manual_while_let_some = "warn"
|
||||||
|
map_collect_result_unit = "warn"
|
||||||
match_like_matches_macro = "warn"
|
match_like_matches_macro = "warn"
|
||||||
module_inception = { level = "deny" }
|
match_overlapping_arm = "warn"
|
||||||
question_mark = { level = "deny" }
|
mem_replace_option_with_none = "warn"
|
||||||
single_match = "warn"
|
mem_replace_option_with_some = "warn"
|
||||||
redundant_closure = { level = "deny" }
|
missing_enforced_import_renames = "warn"
|
||||||
redundant_static_lifetimes = { level = "warn" }
|
missing_safety_doc = "warn"
|
||||||
redundant_pattern_matching = "warn"
|
mixed_attributes_style = "warn"
|
||||||
|
mixed_case_hex_literals = "warn"
|
||||||
|
module_inception = "warn"
|
||||||
|
must_use_unit = "warn"
|
||||||
|
mut_mutex_lock = "warn"
|
||||||
|
needless_borrow = "warn"
|
||||||
|
needless_doctest_main = "warn"
|
||||||
|
needless_else = "warn"
|
||||||
|
needless_parens_on_range_literals = "warn"
|
||||||
|
needless_pub_self = "warn"
|
||||||
|
needless_return = "warn"
|
||||||
|
needless_return_with_question_mark = "warn"
|
||||||
|
ok_expect = "warn"
|
||||||
|
owned_cow = "warn"
|
||||||
|
print_literal = "warn"
|
||||||
|
print_with_newline = "warn"
|
||||||
|
ptr_eq = "warn"
|
||||||
|
question_mark = "warn"
|
||||||
|
redundant_closure = "warn"
|
||||||
redundant_field_names = "warn"
|
redundant_field_names = "warn"
|
||||||
collapsible_if = { level = "warn"}
|
redundant_pattern_matching = "warn"
|
||||||
collapsible_else_if = { level = "warn" }
|
redundant_static_lifetimes = "warn"
|
||||||
needless_borrow = { level = "warn"}
|
result_map_or_into_option = "warn"
|
||||||
needless_return = { level = "warn" }
|
self_named_constructors = "warn"
|
||||||
unnecessary_mut_passed = {level = "warn"}
|
single_match = "warn"
|
||||||
unnecessary_map_or = { level = "warn" }
|
tabs_in_doc_comments = "warn"
|
||||||
|
to_digit_is_some = "warn"
|
||||||
|
toplevel_ref_arg = "warn"
|
||||||
|
unnecessary_fold = "warn"
|
||||||
|
unnecessary_map_or = "warn"
|
||||||
|
unnecessary_mut_passed = "warn"
|
||||||
|
unnecessary_owned_empty_strings = "warn"
|
||||||
|
unneeded_struct_pattern = "warn"
|
||||||
|
unsafe_removed_from_name = "warn"
|
||||||
unused_unit = "warn"
|
unused_unit = "warn"
|
||||||
|
unusual_byte_groupings = "warn"
|
||||||
|
write_literal = "warn"
|
||||||
|
writeln_empty_string = "warn"
|
||||||
wrong_self_convention = "warn"
|
wrong_self_convention = "warn"
|
||||||
|
zero_ptr = "warn"
|
||||||
|
|
||||||
# Individual rules that have violations in the codebase:
|
# Individual rules that have violations in the codebase:
|
||||||
type_complexity = "allow"
|
type_complexity = "allow"
|
||||||
|
|
|
@ -190,7 +190,7 @@ impl ActionLog {
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
match event {
|
||||||
BufferEvent::Edited { .. } => self.handle_buffer_edited(buffer, cx),
|
BufferEvent::Edited => self.handle_buffer_edited(buffer, cx),
|
||||||
BufferEvent::FileHandleChanged => {
|
BufferEvent::FileHandleChanged => {
|
||||||
self.handle_buffer_file_changed(buffer, cx);
|
self.handle_buffer_file_changed(buffer, cx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ impl ActivityIndicator {
|
||||||
&workspace_handle,
|
&workspace_handle,
|
||||||
window,
|
window,
|
||||||
|activity_indicator, _, event, window, cx| {
|
|activity_indicator, _, event, window, cx| {
|
||||||
if let workspace::Event::ClearActivityIndicator { .. } = event
|
if let workspace::Event::ClearActivityIndicator = event
|
||||||
&& activity_indicator.statuses.pop().is_some()
|
&& activity_indicator.statuses.pop().is_some()
|
||||||
{
|
{
|
||||||
activity_indicator.dismiss_error_message(&DismissErrorMessage, window, cx);
|
activity_indicator.dismiss_error_message(&DismissErrorMessage, window, cx);
|
||||||
|
|
|
@ -1229,27 +1229,27 @@ pub enum GenerationMode {
|
||||||
impl GenerationMode {
|
impl GenerationMode {
|
||||||
fn start_label(self) -> &'static str {
|
fn start_label(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
GenerationMode::Generate { .. } => "Generate",
|
GenerationMode::Generate => "Generate",
|
||||||
GenerationMode::Transform => "Transform",
|
GenerationMode::Transform => "Transform",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fn tooltip_interrupt(self) -> &'static str {
|
fn tooltip_interrupt(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
GenerationMode::Generate { .. } => "Interrupt Generation",
|
GenerationMode::Generate => "Interrupt Generation",
|
||||||
GenerationMode::Transform => "Interrupt Transform",
|
GenerationMode::Transform => "Interrupt Transform",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tooltip_restart(self) -> &'static str {
|
fn tooltip_restart(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
GenerationMode::Generate { .. } => "Restart Generation",
|
GenerationMode::Generate => "Restart Generation",
|
||||||
GenerationMode::Transform => "Restart Transform",
|
GenerationMode::Transform => "Restart Transform",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn tooltip_accept(self) -> &'static str {
|
fn tooltip_accept(self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
GenerationMode::Generate { .. } => "Accept Generation",
|
GenerationMode::Generate => "Accept Generation",
|
||||||
GenerationMode::Transform => "Accept Transform",
|
GenerationMode::Transform => "Accept Transform",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1029,11 +1029,11 @@ impl Client {
|
||||||
Status::SignedOut | Status::Authenticated => true,
|
Status::SignedOut | Status::Authenticated => true,
|
||||||
Status::ConnectionError
|
Status::ConnectionError
|
||||||
| Status::ConnectionLost
|
| Status::ConnectionLost
|
||||||
| Status::Authenticating { .. }
|
| Status::Authenticating
|
||||||
| Status::AuthenticationError
|
| Status::AuthenticationError
|
||||||
| Status::Reauthenticating { .. }
|
| Status::Reauthenticating
|
||||||
| Status::ReconnectionError { .. } => false,
|
| Status::ReconnectionError { .. } => false,
|
||||||
Status::Connected { .. } | Status::Connecting { .. } | Status::Reconnecting { .. } => {
|
Status::Connected { .. } | Status::Connecting | Status::Reconnecting => {
|
||||||
return ConnectionResult::Result(Ok(()));
|
return ConnectionResult::Result(Ok(()));
|
||||||
}
|
}
|
||||||
Status::UpgradeRequired => {
|
Status::UpgradeRequired => {
|
||||||
|
@ -1902,10 +1902,7 @@ mod tests {
|
||||||
assert!(matches!(status.next().await, Some(Status::Connecting)));
|
assert!(matches!(status.next().await, Some(Status::Connecting)));
|
||||||
|
|
||||||
executor.advance_clock(CONNECTION_TIMEOUT);
|
executor.advance_clock(CONNECTION_TIMEOUT);
|
||||||
assert!(matches!(
|
assert!(matches!(status.next().await, Some(Status::ConnectionError)));
|
||||||
status.next().await,
|
|
||||||
Some(Status::ConnectionError { .. })
|
|
||||||
));
|
|
||||||
auth_and_connect.await.into_response().unwrap_err();
|
auth_and_connect.await.into_response().unwrap_err();
|
||||||
|
|
||||||
// Allow the connection to be established.
|
// Allow the connection to be established.
|
||||||
|
@ -1929,10 +1926,7 @@ mod tests {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
executor.advance_clock(2 * INITIAL_RECONNECTION_DELAY);
|
executor.advance_clock(2 * INITIAL_RECONNECTION_DELAY);
|
||||||
assert!(matches!(
|
assert!(matches!(status.next().await, Some(Status::Reconnecting)));
|
||||||
status.next().await,
|
|
||||||
Some(Status::Reconnecting { .. })
|
|
||||||
));
|
|
||||||
|
|
||||||
executor.advance_clock(CONNECTION_TIMEOUT);
|
executor.advance_clock(CONNECTION_TIMEOUT);
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
|
|
|
@ -126,7 +126,7 @@ impl CopilotServer {
|
||||||
fn as_authenticated(&mut self) -> Result<&mut RunningCopilotServer> {
|
fn as_authenticated(&mut self) -> Result<&mut RunningCopilotServer> {
|
||||||
let server = self.as_running()?;
|
let server = self.as_running()?;
|
||||||
anyhow::ensure!(
|
anyhow::ensure!(
|
||||||
matches!(server.sign_in_status, SignInStatus::Authorized { .. }),
|
matches!(server.sign_in_status, SignInStatus::Authorized),
|
||||||
"must sign in before using copilot"
|
"must sign in before using copilot"
|
||||||
);
|
);
|
||||||
Ok(server)
|
Ok(server)
|
||||||
|
@ -578,12 +578,12 @@ impl Copilot {
|
||||||
pub(crate) fn sign_in(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
pub(crate) fn sign_in(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
|
||||||
if let CopilotServer::Running(server) = &mut self.server {
|
if let CopilotServer::Running(server) = &mut self.server {
|
||||||
let task = match &server.sign_in_status {
|
let task = match &server.sign_in_status {
|
||||||
SignInStatus::Authorized { .. } => Task::ready(Ok(())).shared(),
|
SignInStatus::Authorized => Task::ready(Ok(())).shared(),
|
||||||
SignInStatus::SigningIn { task, .. } => {
|
SignInStatus::SigningIn { task, .. } => {
|
||||||
cx.notify();
|
cx.notify();
|
||||||
task.clone()
|
task.clone()
|
||||||
}
|
}
|
||||||
SignInStatus::SignedOut { .. } | SignInStatus::Unauthorized { .. } => {
|
SignInStatus::SignedOut { .. } | SignInStatus::Unauthorized => {
|
||||||
let lsp = server.lsp.clone();
|
let lsp = server.lsp.clone();
|
||||||
let task = cx
|
let task = cx
|
||||||
.spawn(async move |this, cx| {
|
.spawn(async move |this, cx| {
|
||||||
|
@ -727,7 +727,7 @@ impl Copilot {
|
||||||
..
|
..
|
||||||
}) = &mut self.server
|
}) = &mut self.server
|
||||||
{
|
{
|
||||||
if !matches!(status, SignInStatus::Authorized { .. }) {
|
if !matches!(status, SignInStatus::Authorized) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,8 +1009,8 @@ impl Copilot {
|
||||||
CopilotServer::Error(error) => Status::Error(error.clone()),
|
CopilotServer::Error(error) => Status::Error(error.clone()),
|
||||||
CopilotServer::Running(RunningCopilotServer { sign_in_status, .. }) => {
|
CopilotServer::Running(RunningCopilotServer { sign_in_status, .. }) => {
|
||||||
match sign_in_status {
|
match sign_in_status {
|
||||||
SignInStatus::Authorized { .. } => Status::Authorized,
|
SignInStatus::Authorized => Status::Authorized,
|
||||||
SignInStatus::Unauthorized { .. } => Status::Unauthorized,
|
SignInStatus::Unauthorized => Status::Unauthorized,
|
||||||
SignInStatus::SigningIn { prompt, .. } => Status::SigningIn {
|
SignInStatus::SigningIn { prompt, .. } => Status::SigningIn {
|
||||||
prompt: prompt.clone(),
|
prompt: prompt.clone(),
|
||||||
},
|
},
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub enum DataCollectionState {
|
||||||
|
|
||||||
impl DataCollectionState {
|
impl DataCollectionState {
|
||||||
pub fn is_supported(&self) -> bool {
|
pub fn is_supported(&self) -> bool {
|
||||||
!matches!(self, DataCollectionState::Unsupported { .. })
|
!matches!(self, DataCollectionState::Unsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_enabled(&self) -> bool {
|
pub fn is_enabled(&self) -> bool {
|
||||||
|
|
|
@ -1854,8 +1854,8 @@ impl Editor {
|
||||||
blink_manager
|
blink_manager
|
||||||
});
|
});
|
||||||
|
|
||||||
let soft_wrap_mode_override = matches!(mode, EditorMode::SingleLine { .. })
|
let soft_wrap_mode_override =
|
||||||
.then(|| language_settings::SoftWrap::None);
|
matches!(mode, EditorMode::SingleLine).then(|| language_settings::SoftWrap::None);
|
||||||
|
|
||||||
let mut project_subscriptions = Vec::new();
|
let mut project_subscriptions = Vec::new();
|
||||||
if full_mode && let Some(project) = project.as_ref() {
|
if full_mode && let Some(project) = project.as_ref() {
|
||||||
|
@ -1980,14 +1980,12 @@ impl Editor {
|
||||||
.detach();
|
.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
let show_indent_guides = if matches!(
|
let show_indent_guides =
|
||||||
mode,
|
if matches!(mode, EditorMode::SingleLine | EditorMode::Minimap { .. }) {
|
||||||
EditorMode::SingleLine { .. } | EditorMode::Minimap { .. }
|
Some(false)
|
||||||
) {
|
} else {
|
||||||
Some(false)
|
None
|
||||||
} else {
|
};
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
let breakpoint_store = match (&mode, project.as_ref()) {
|
let breakpoint_store = match (&mode, project.as_ref()) {
|
||||||
(EditorMode::Full { .. }, Some(project)) => Some(project.read(cx).breakpoint_store()),
|
(EditorMode::Full { .. }, Some(project)) => Some(project.read(cx).breakpoint_store()),
|
||||||
|
@ -2047,7 +2045,7 @@ impl Editor {
|
||||||
vertical: full_mode,
|
vertical: full_mode,
|
||||||
},
|
},
|
||||||
minimap_visibility: MinimapVisibility::for_mode(&mode, cx),
|
minimap_visibility: MinimapVisibility::for_mode(&mode, cx),
|
||||||
offset_content: !matches!(mode, EditorMode::SingleLine { .. }),
|
offset_content: !matches!(mode, EditorMode::SingleLine),
|
||||||
show_breadcrumbs: EditorSettings::get_global(cx).toolbar.breadcrumbs,
|
show_breadcrumbs: EditorSettings::get_global(cx).toolbar.breadcrumbs,
|
||||||
show_gutter: full_mode,
|
show_gutter: full_mode,
|
||||||
show_line_numbers: (!full_mode).then_some(false),
|
show_line_numbers: (!full_mode).then_some(false),
|
||||||
|
@ -2401,7 +2399,7 @@ impl Editor {
|
||||||
let mut key_context = KeyContext::new_with_defaults();
|
let mut key_context = KeyContext::new_with_defaults();
|
||||||
key_context.add("Editor");
|
key_context.add("Editor");
|
||||||
let mode = match self.mode {
|
let mode = match self.mode {
|
||||||
EditorMode::SingleLine { .. } => "single_line",
|
EditorMode::SingleLine => "single_line",
|
||||||
EditorMode::AutoHeight { .. } => "auto_height",
|
EditorMode::AutoHeight { .. } => "auto_height",
|
||||||
EditorMode::Minimap { .. } => "minimap",
|
EditorMode::Minimap { .. } => "minimap",
|
||||||
EditorMode::Full { .. } => "full",
|
EditorMode::Full { .. } => "full",
|
||||||
|
@ -6772,7 +6770,7 @@ impl Editor {
|
||||||
&mut self,
|
&mut self,
|
||||||
cx: &mut Context<Editor>,
|
cx: &mut Context<Editor>,
|
||||||
) -> Option<(String, Range<Anchor>)> {
|
) -> Option<(String, Range<Anchor>)> {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
if !EditorSettings::get_global(cx).selection_highlight {
|
if !EditorSettings::get_global(cx).selection_highlight {
|
||||||
|
@ -12601,7 +12599,7 @@ impl Editor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -12725,7 +12723,7 @@ impl Editor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13209,7 +13207,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13230,7 +13228,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13251,7 +13249,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13272,7 +13270,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13293,7 +13291,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13318,7 +13316,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13343,7 +13341,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13368,7 +13366,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13393,7 +13391,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13414,7 +13412,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13435,7 +13433,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13456,7 +13454,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13477,7 +13475,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -13502,7 +13500,7 @@ impl Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn move_to_end(&mut self, _: &MoveToEnd, window: &mut Window, cx: &mut Context<Self>) {
|
pub fn move_to_end(&mut self, _: &MoveToEnd, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -14551,7 +14549,7 @@ impl Editor {
|
||||||
let advance_downwards = action.advance_downwards
|
let advance_downwards = action.advance_downwards
|
||||||
&& selections_on_single_row
|
&& selections_on_single_row
|
||||||
&& !selections_selecting
|
&& !selections_selecting
|
||||||
&& !matches!(this.mode, EditorMode::SingleLine { .. });
|
&& !matches!(this.mode, EditorMode::SingleLine);
|
||||||
|
|
||||||
if advance_downwards {
|
if advance_downwards {
|
||||||
let snapshot = this.buffer.read(cx).snapshot(cx);
|
let snapshot = this.buffer.read(cx).snapshot(cx);
|
||||||
|
@ -22867,7 +22865,7 @@ impl Render for Editor {
|
||||||
let settings = ThemeSettings::get_global(cx);
|
let settings = ThemeSettings::get_global(cx);
|
||||||
|
|
||||||
let mut text_style = match self.mode {
|
let mut text_style = match self.mode {
|
||||||
EditorMode::SingleLine { .. } | EditorMode::AutoHeight { .. } => TextStyle {
|
EditorMode::SingleLine | EditorMode::AutoHeight { .. } => TextStyle {
|
||||||
color: cx.theme().colors().editor_foreground,
|
color: cx.theme().colors().editor_foreground,
|
||||||
font_family: settings.ui_font.family.clone(),
|
font_family: settings.ui_font.family.clone(),
|
||||||
font_features: settings.ui_font.features.clone(),
|
font_features: settings.ui_font.features.clone(),
|
||||||
|
@ -22893,7 +22891,7 @@ impl Render for Editor {
|
||||||
}
|
}
|
||||||
|
|
||||||
let background = match self.mode {
|
let background = match self.mode {
|
||||||
EditorMode::SingleLine { .. } => cx.theme().system().transparent,
|
EditorMode::SingleLine => cx.theme().system().transparent,
|
||||||
EditorMode::AutoHeight { .. } => cx.theme().system().transparent,
|
EditorMode::AutoHeight { .. } => cx.theme().system().transparent,
|
||||||
EditorMode::Full { .. } => cx.theme().colors().editor_background,
|
EditorMode::Full { .. } => cx.theme().colors().editor_background,
|
||||||
EditorMode::Minimap { .. } => cx.theme().colors().editor_background.opacity(0.7),
|
EditorMode::Minimap { .. } => cx.theme().colors().editor_background.opacity(0.7),
|
||||||
|
|
|
@ -8105,7 +8105,7 @@ impl Element for EditorElement {
|
||||||
// The max scroll position for the top of the window
|
// The max scroll position for the top of the window
|
||||||
let max_scroll_top = if matches!(
|
let max_scroll_top = if matches!(
|
||||||
snapshot.mode,
|
snapshot.mode,
|
||||||
EditorMode::SingleLine { .. }
|
EditorMode::SingleLine
|
||||||
| EditorMode::AutoHeight { .. }
|
| EditorMode::AutoHeight { .. }
|
||||||
| EditorMode::Full {
|
| EditorMode::Full {
|
||||||
sized_by_content: true,
|
sized_by_content: true,
|
||||||
|
|
|
@ -675,7 +675,7 @@ impl Editor {
|
||||||
window: &mut Window,
|
window: &mut Window,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ impl Editor {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches!(self.mode, EditorMode::SingleLine { .. }) {
|
if matches!(self.mode, EditorMode::SingleLine) {
|
||||||
cx.propagate();
|
cx.propagate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2983,9 +2983,7 @@ impl GitPanel {
|
||||||
let status_toast = StatusToast::new(message, cx, move |this, _cx| {
|
let status_toast = StatusToast::new(message, cx, move |this, _cx| {
|
||||||
use remote_output::SuccessStyle::*;
|
use remote_output::SuccessStyle::*;
|
||||||
match style {
|
match style {
|
||||||
Toast { .. } => {
|
Toast => this.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted)),
|
||||||
this.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted))
|
|
||||||
}
|
|
||||||
ToastWithLog { output } => this
|
ToastWithLog { output } => this
|
||||||
.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted))
|
.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted))
|
||||||
.action("View Log", move |window, cx| {
|
.action("View Log", move |window, cx| {
|
||||||
|
|
|
@ -106,7 +106,7 @@ impl CursorPosition {
|
||||||
cursor_position.selected_count.selections = editor.selections.count();
|
cursor_position.selected_count.selections = editor.selections.count();
|
||||||
match editor.mode() {
|
match editor.mode() {
|
||||||
editor::EditorMode::AutoHeight { .. }
|
editor::EditorMode::AutoHeight { .. }
|
||||||
| editor::EditorMode::SingleLine { .. }
|
| editor::EditorMode::SingleLine
|
||||||
| editor::EditorMode::Minimap { .. } => {
|
| editor::EditorMode::Minimap { .. } => {
|
||||||
cursor_position.position = None;
|
cursor_position.position = None;
|
||||||
cursor_position.context = None;
|
cursor_position.context = None;
|
||||||
|
|
|
@ -157,7 +157,7 @@ impl GoToLine {
|
||||||
self.prev_scroll_position.take();
|
self.prev_scroll_position.take();
|
||||||
cx.emit(DismissEvent)
|
cx.emit(DismissEvent)
|
||||||
}
|
}
|
||||||
editor::EditorEvent::BufferEdited { .. } => self.highlight_current_line(cx),
|
editor::EditorEvent::BufferEdited => self.highlight_current_line(cx),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -362,13 +362,12 @@ impl Component for ThemePreviewTile {
|
||||||
.gap_4()
|
.gap_4()
|
||||||
.children(
|
.children(
|
||||||
themes_to_preview
|
themes_to_preview
|
||||||
.iter()
|
.into_iter()
|
||||||
.enumerate()
|
.map(|theme| {
|
||||||
.map(|(_, theme)| {
|
|
||||||
div()
|
div()
|
||||||
.w(px(200.))
|
.w(px(200.))
|
||||||
.h(px(140.))
|
.h(px(140.))
|
||||||
.child(ThemePreviewTile::new(theme.clone(), 0.42))
|
.child(ThemePreviewTile::new(theme, 0.42))
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>(),
|
.collect::<Vec<_>>(),
|
||||||
)
|
)
|
||||||
|
|
|
@ -3924,9 +3924,7 @@ impl LspStore {
|
||||||
_: &mut Context<Self>,
|
_: &mut Context<Self>,
|
||||||
) {
|
) {
|
||||||
match event {
|
match event {
|
||||||
ToolchainStoreEvent::ToolchainActivated { .. } => {
|
ToolchainStoreEvent::ToolchainActivated => self.request_workspace_config_refresh(),
|
||||||
self.request_workspace_config_refresh()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3119,7 +3119,7 @@ impl Project {
|
||||||
event: &BufferEvent,
|
event: &BufferEvent,
|
||||||
cx: &mut Context<Self>,
|
cx: &mut Context<Self>,
|
||||||
) -> Option<()> {
|
) -> Option<()> {
|
||||||
if matches!(event, BufferEvent::Edited { .. } | BufferEvent::Reloaded) {
|
if matches!(event, BufferEvent::Edited | BufferEvent::Reloaded) {
|
||||||
self.request_buffer_diff_recalculation(&buffer, cx);
|
self.request_buffer_diff_recalculation(&buffer, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -948,7 +948,7 @@ impl SshRemoteClient {
|
||||||
if old_state.is_reconnecting() {
|
if old_state.is_reconnecting() {
|
||||||
match &new_state {
|
match &new_state {
|
||||||
State::Connecting
|
State::Connecting
|
||||||
| State::Reconnecting { .. }
|
| State::Reconnecting
|
||||||
| State::HeartbeatMissed { .. }
|
| State::HeartbeatMissed { .. }
|
||||||
| State::ServerNotRunning => {}
|
| State::ServerNotRunning => {}
|
||||||
State::Connected { .. } => {
|
State::Connected { .. } => {
|
||||||
|
|
|
@ -563,8 +563,8 @@ impl TitleBar {
|
||||||
match status {
|
match status {
|
||||||
client::Status::ConnectionError
|
client::Status::ConnectionError
|
||||||
| client::Status::ConnectionLost
|
| client::Status::ConnectionLost
|
||||||
| client::Status::Reauthenticating { .. }
|
| client::Status::Reauthenticating
|
||||||
| client::Status::Reconnecting { .. }
|
| client::Status::Reconnecting
|
||||||
| client::Status::ReconnectionError { .. } => Some(
|
| client::Status::ReconnectionError { .. } => Some(
|
||||||
div()
|
div()
|
||||||
.id("disconnected")
|
.id("disconnected")
|
||||||
|
|
|
@ -7670,7 +7670,7 @@ pub fn client_side_decorations(
|
||||||
|
|
||||||
match decorations {
|
match decorations {
|
||||||
Decorations::Client { .. } => window.set_client_inset(theme::CLIENT_SIDE_DECORATION_SHADOW),
|
Decorations::Client { .. } => window.set_client_inset(theme::CLIENT_SIDE_DECORATION_SHADOW),
|
||||||
Decorations::Server { .. } => window.set_client_inset(px(0.0)),
|
Decorations::Server => window.set_client_inset(px(0.0)),
|
||||||
}
|
}
|
||||||
|
|
||||||
struct GlobalResizeEdge(ResizeEdge);
|
struct GlobalResizeEdge(ResizeEdge);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue