Detailed changes
@@ -825,36 +825,106 @@ declare_interior_mutable_const = "deny"
style = { level = "allow", priority = -1 }
# 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"
+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"
+default_instead_of_iter_empty = "warn"
+disallowed_macros = "warn"
+disallowed_methods = "warn"
+disallowed_names = "warn"
+disallowed_types = "warn"
doc_lazy_continuation = "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"
+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"
io_other_error = "warn"
+items_after_test_module = "warn"
iter_cloned_collect = "warn"
iter_next_slice = "warn"
iter_nth = "warn"
iter_nth_zero = "warn"
iter_skip_next = "warn"
+just_underscores_and_digits = "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"
-module_inception = { level = "deny" }
-question_mark = { level = "deny" }
-single_match = "warn"
-redundant_closure = { level = "deny" }
-redundant_static_lifetimes = { level = "warn" }
-redundant_pattern_matching = "warn"
+match_overlapping_arm = "warn"
+mem_replace_option_with_none = "warn"
+mem_replace_option_with_some = "warn"
+missing_enforced_import_renames = "warn"
+missing_safety_doc = "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"
-collapsible_if = { level = "warn"}
-collapsible_else_if = { level = "warn" }
-needless_borrow = { level = "warn"}
-needless_return = { level = "warn" }
-unnecessary_mut_passed = {level = "warn"}
-unnecessary_map_or = { level = "warn" }
+redundant_pattern_matching = "warn"
+redundant_static_lifetimes = "warn"
+result_map_or_into_option = "warn"
+self_named_constructors = "warn"
+single_match = "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"
+unusual_byte_groupings = "warn"
+write_literal = "warn"
+writeln_empty_string = "warn"
wrong_self_convention = "warn"
+zero_ptr = "warn"
# Individual rules that have violations in the codebase:
type_complexity = "allow"
@@ -190,7 +190,7 @@ impl ActionLog {
cx: &mut Context<Self>,
) {
match event {
- BufferEvent::Edited { .. } => self.handle_buffer_edited(buffer, cx),
+ BufferEvent::Edited => self.handle_buffer_edited(buffer, cx),
BufferEvent::FileHandleChanged => {
self.handle_buffer_file_changed(buffer, cx);
}
@@ -104,7 +104,7 @@ impl ActivityIndicator {
&workspace_handle,
window,
|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.dismiss_error_message(&DismissErrorMessage, window, cx);
@@ -1229,27 +1229,27 @@ pub enum GenerationMode {
impl GenerationMode {
fn start_label(self) -> &'static str {
match self {
- GenerationMode::Generate { .. } => "Generate",
+ GenerationMode::Generate => "Generate",
GenerationMode::Transform => "Transform",
}
}
fn tooltip_interrupt(self) -> &'static str {
match self {
- GenerationMode::Generate { .. } => "Interrupt Generation",
+ GenerationMode::Generate => "Interrupt Generation",
GenerationMode::Transform => "Interrupt Transform",
}
}
fn tooltip_restart(self) -> &'static str {
match self {
- GenerationMode::Generate { .. } => "Restart Generation",
+ GenerationMode::Generate => "Restart Generation",
GenerationMode::Transform => "Restart Transform",
}
}
fn tooltip_accept(self) -> &'static str {
match self {
- GenerationMode::Generate { .. } => "Accept Generation",
+ GenerationMode::Generate => "Accept Generation",
GenerationMode::Transform => "Accept Transform",
}
}
@@ -1029,11 +1029,11 @@ impl Client {
Status::SignedOut | Status::Authenticated => true,
Status::ConnectionError
| Status::ConnectionLost
- | Status::Authenticating { .. }
+ | Status::Authenticating
| Status::AuthenticationError
- | Status::Reauthenticating { .. }
+ | Status::Reauthenticating
| Status::ReconnectionError { .. } => false,
- Status::Connected { .. } | Status::Connecting { .. } | Status::Reconnecting { .. } => {
+ Status::Connected { .. } | Status::Connecting | Status::Reconnecting => {
return ConnectionResult::Result(Ok(()));
}
Status::UpgradeRequired => {
@@ -1902,10 +1902,7 @@ mod tests {
assert!(matches!(status.next().await, Some(Status::Connecting)));
executor.advance_clock(CONNECTION_TIMEOUT);
- assert!(matches!(
- status.next().await,
- Some(Status::ConnectionError { .. })
- ));
+ assert!(matches!(status.next().await, Some(Status::ConnectionError)));
auth_and_connect.await.into_response().unwrap_err();
// Allow the connection to be established.
@@ -1929,10 +1926,7 @@ mod tests {
})
});
executor.advance_clock(2 * INITIAL_RECONNECTION_DELAY);
- assert!(matches!(
- status.next().await,
- Some(Status::Reconnecting { .. })
- ));
+ assert!(matches!(status.next().await, Some(Status::Reconnecting)));
executor.advance_clock(CONNECTION_TIMEOUT);
assert!(matches!(
@@ -126,7 +126,7 @@ impl CopilotServer {
fn as_authenticated(&mut self) -> Result<&mut RunningCopilotServer> {
let server = self.as_running()?;
anyhow::ensure!(
- matches!(server.sign_in_status, SignInStatus::Authorized { .. }),
+ matches!(server.sign_in_status, SignInStatus::Authorized),
"must sign in before using copilot"
);
Ok(server)
@@ -578,12 +578,12 @@ impl Copilot {
pub(crate) fn sign_in(&mut self, cx: &mut Context<Self>) -> Task<Result<()>> {
if let CopilotServer::Running(server) = &mut self.server {
let task = match &server.sign_in_status {
- SignInStatus::Authorized { .. } => Task::ready(Ok(())).shared(),
+ SignInStatus::Authorized => Task::ready(Ok(())).shared(),
SignInStatus::SigningIn { task, .. } => {
cx.notify();
task.clone()
}
- SignInStatus::SignedOut { .. } | SignInStatus::Unauthorized { .. } => {
+ SignInStatus::SignedOut { .. } | SignInStatus::Unauthorized => {
let lsp = server.lsp.clone();
let task = cx
.spawn(async move |this, cx| {
@@ -727,7 +727,7 @@ impl Copilot {
..
}) = &mut self.server
{
- if !matches!(status, SignInStatus::Authorized { .. }) {
+ if !matches!(status, SignInStatus::Authorized) {
return;
}
@@ -1009,8 +1009,8 @@ impl Copilot {
CopilotServer::Error(error) => Status::Error(error.clone()),
CopilotServer::Running(RunningCopilotServer { sign_in_status, .. }) => {
match sign_in_status {
- SignInStatus::Authorized { .. } => Status::Authorized,
- SignInStatus::Unauthorized { .. } => Status::Unauthorized,
+ SignInStatus::Authorized => Status::Authorized,
+ SignInStatus::Unauthorized => Status::Unauthorized,
SignInStatus::SigningIn { prompt, .. } => Status::SigningIn {
prompt: prompt.clone(),
},
@@ -34,7 +34,7 @@ pub enum DataCollectionState {
impl DataCollectionState {
pub fn is_supported(&self) -> bool {
- !matches!(self, DataCollectionState::Unsupported { .. })
+ !matches!(self, DataCollectionState::Unsupported)
}
pub fn is_enabled(&self) -> bool {
@@ -1854,8 +1854,8 @@ impl Editor {
blink_manager
});
- let soft_wrap_mode_override = matches!(mode, EditorMode::SingleLine { .. })
- .then(|| language_settings::SoftWrap::None);
+ let soft_wrap_mode_override =
+ matches!(mode, EditorMode::SingleLine).then(|| language_settings::SoftWrap::None);
let mut project_subscriptions = Vec::new();
if full_mode && let Some(project) = project.as_ref() {
@@ -1980,14 +1980,12 @@ impl Editor {
.detach();
}
- let show_indent_guides = if matches!(
- mode,
- EditorMode::SingleLine { .. } | EditorMode::Minimap { .. }
- ) {
- Some(false)
- } else {
- None
- };
+ let show_indent_guides =
+ if matches!(mode, EditorMode::SingleLine | EditorMode::Minimap { .. }) {
+ Some(false)
+ } else {
+ None
+ };
let breakpoint_store = match (&mode, project.as_ref()) {
(EditorMode::Full { .. }, Some(project)) => Some(project.read(cx).breakpoint_store()),
@@ -2047,7 +2045,7 @@ impl Editor {
vertical: full_mode,
},
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_gutter: full_mode,
show_line_numbers: (!full_mode).then_some(false),
@@ -2401,7 +2399,7 @@ impl Editor {
let mut key_context = KeyContext::new_with_defaults();
key_context.add("Editor");
let mode = match self.mode {
- EditorMode::SingleLine { .. } => "single_line",
+ EditorMode::SingleLine => "single_line",
EditorMode::AutoHeight { .. } => "auto_height",
EditorMode::Minimap { .. } => "minimap",
EditorMode::Full { .. } => "full",
@@ -6772,7 +6770,7 @@ impl Editor {
&mut self,
cx: &mut Context<Editor>,
) -> Option<(String, Range<Anchor>)> {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
return None;
}
if !EditorSettings::get_global(cx).selection_highlight {
@@ -12601,7 +12599,7 @@ impl Editor {
return;
}
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -12725,7 +12723,7 @@ impl Editor {
return;
}
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13209,7 +13207,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13230,7 +13228,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13251,7 +13249,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13272,7 +13270,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13293,7 +13291,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13318,7 +13316,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13343,7 +13341,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13368,7 +13366,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13393,7 +13391,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13414,7 +13412,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13435,7 +13433,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13456,7 +13454,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13477,7 +13475,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -13502,7 +13500,7 @@ impl Editor {
}
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();
return;
}
@@ -14551,7 +14549,7 @@ impl Editor {
let advance_downwards = action.advance_downwards
&& selections_on_single_row
&& !selections_selecting
- && !matches!(this.mode, EditorMode::SingleLine { .. });
+ && !matches!(this.mode, EditorMode::SingleLine);
if advance_downwards {
let snapshot = this.buffer.read(cx).snapshot(cx);
@@ -22867,7 +22865,7 @@ impl Render for Editor {
let settings = ThemeSettings::get_global(cx);
let mut text_style = match self.mode {
- EditorMode::SingleLine { .. } | EditorMode::AutoHeight { .. } => TextStyle {
+ EditorMode::SingleLine | EditorMode::AutoHeight { .. } => TextStyle {
color: cx.theme().colors().editor_foreground,
font_family: settings.ui_font.family.clone(),
font_features: settings.ui_font.features.clone(),
@@ -22893,7 +22891,7 @@ impl Render for Editor {
}
let background = match self.mode {
- EditorMode::SingleLine { .. } => cx.theme().system().transparent,
+ EditorMode::SingleLine => cx.theme().system().transparent,
EditorMode::AutoHeight { .. } => cx.theme().system().transparent,
EditorMode::Full { .. } => cx.theme().colors().editor_background,
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
let max_scroll_top = if matches!(
snapshot.mode,
- EditorMode::SingleLine { .. }
+ EditorMode::SingleLine
| EditorMode::AutoHeight { .. }
| EditorMode::Full {
sized_by_content: true,
@@ -675,7 +675,7 @@ impl Editor {
window: &mut Window,
cx: &mut Context<Self>,
) {
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -16,7 +16,7 @@ impl Editor {
return;
}
- if matches!(self.mode, EditorMode::SingleLine { .. }) {
+ if matches!(self.mode, EditorMode::SingleLine) {
cx.propagate();
return;
}
@@ -2983,9 +2983,7 @@ impl GitPanel {
let status_toast = StatusToast::new(message, cx, move |this, _cx| {
use remote_output::SuccessStyle::*;
match style {
- Toast { .. } => {
- this.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted))
- }
+ Toast => this.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted)),
ToastWithLog { output } => this
.icon(ToastIcon::new(IconName::GitBranchAlt).color(Color::Muted))
.action("View Log", move |window, cx| {
@@ -106,7 +106,7 @@ impl CursorPosition {
cursor_position.selected_count.selections = editor.selections.count();
match editor.mode() {
editor::EditorMode::AutoHeight { .. }
- | editor::EditorMode::SingleLine { .. }
+ | editor::EditorMode::SingleLine
| editor::EditorMode::Minimap { .. } => {
cursor_position.position = None;
cursor_position.context = None;
@@ -157,7 +157,7 @@ impl GoToLine {
self.prev_scroll_position.take();
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()
.children(
themes_to_preview
- .iter()
- .enumerate()
- .map(|(_, theme)| {
+ .into_iter()
+ .map(|theme| {
div()
.w(px(200.))
.h(px(140.))
- .child(ThemePreviewTile::new(theme.clone(), 0.42))
+ .child(ThemePreviewTile::new(theme, 0.42))
})
.collect::<Vec<_>>(),
)
@@ -3924,9 +3924,7 @@ impl LspStore {
_: &mut Context<Self>,
) {
match event {
- ToolchainStoreEvent::ToolchainActivated { .. } => {
- self.request_workspace_config_refresh()
- }
+ ToolchainStoreEvent::ToolchainActivated => self.request_workspace_config_refresh(),
}
}
@@ -3119,7 +3119,7 @@ impl Project {
event: &BufferEvent,
cx: &mut Context<Self>,
) -> Option<()> {
- if matches!(event, BufferEvent::Edited { .. } | BufferEvent::Reloaded) {
+ if matches!(event, BufferEvent::Edited | BufferEvent::Reloaded) {
self.request_buffer_diff_recalculation(&buffer, cx);
}
@@ -948,7 +948,7 @@ impl SshRemoteClient {
if old_state.is_reconnecting() {
match &new_state {
State::Connecting
- | State::Reconnecting { .. }
+ | State::Reconnecting
| State::HeartbeatMissed { .. }
| State::ServerNotRunning => {}
State::Connected { .. } => {
@@ -563,8 +563,8 @@ impl TitleBar {
match status {
client::Status::ConnectionError
| client::Status::ConnectionLost
- | client::Status::Reauthenticating { .. }
- | client::Status::Reconnecting { .. }
+ | client::Status::Reauthenticating
+ | client::Status::Reconnecting
| client::Status::ReconnectionError { .. } => Some(
div()
.id("disconnected")
@@ -7670,7 +7670,7 @@ pub fn client_side_decorations(
match decorations {
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);