mirror of
https://github.com/zed-industries/zed.git
synced 2026-07-09 16:00:35 +00:00
Adds a dylint library under tooling/lints that flags Zed-specific anti-patterns: * shared_string_from_str_literal, * async_block_without_await, * entity_update_in_render, * notify_in_render, * owned_string_into_shared, * len_in_loop_condition, and * blocking_io_on_foreground. Includes UI tests, a single-lint helper, and workspace.metadata.dylint registration so cargo dylint --all discovers it. The library pins its own nightly toolchain (kept out of the main workspace) and tracks dylint 6. Release Notes: - N/A Self-Review Checklist: - [ ] I've reviewed my own diff for quality, security, and reliability - [ ] Unsafe blocks (if any) have justifying comments - [ ] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [ ] Performance impact has been considered and is acceptable Closes #ISSUE Release Notes: - N/A or Added/Fixed/Improved ...
53 lines
2.5 KiB
Text
53 lines
2.5 KiB
Text
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:13:24
|
|
|
|
|
LL | let _a: Arc<str> = String::from("hello").into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D owned-string-into-shared` implied by `-D warnings`
|
|
= help: to override `-D warnings` add `#[allow(owned_string_into_shared)]`
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:16:23
|
|
|
|
|
LL | let _b: Rc<str> = String::from("world").into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:19:28
|
|
|
|
|
LL | let _c: Cow<'_, str> = String::from("borrowed-or-owned").into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:22:24
|
|
|
|
|
LL | let _d: Arc<str> = "via-to-string".to_string().into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:25:24
|
|
|
|
|
LL | let _e: Arc<str> = "via-to-owned".to_owned().into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:28:23
|
|
|
|
|
LL | let _f: Rc<str> = "rc-via-to-string".to_string().into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:31:28
|
|
|
|
|
LL | let _g: Cow<'_, str> = "cow-via-to-owned".to_owned().into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: this allocates an owned `String` from a string literal only to convert it into a refcounted string
|
|
--> $DIR/owned_string_into_shared.rs:35:9
|
|
|
|
|
LL | String::from("this literal is definitely longer than twenty three bytes").into();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 8 previous errors
|
|
|