Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
*-. | Merge #7570 #7571 | bors[bot] | 2021-02-05 | 1 | -160/+119 |
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 7570: Add doc gen to the `generate_enum_match_method` assist r=yoshuawuyts a=yoshuawuyts Implements a small extension to https://github.com/rust-analyzer/rust-analyzer/pull/7562, generating default comments. I wasn't sure if this would fit the goals of Rust-Analyzer, so I chose to split it into a separate PR. This is especially useful when writing code in a codebase which uses `#![warn(missing_docs)]` lint, as many production-grade libraries do. The comments we're generating here are similar to the ones found on [`Option::is_some`](https://doc.rust-lang.org/std/option/enum.Option.html#method.is_some) and [`Result::is_err`](https://doc.rust-lang.org/std/result/enum.Result.html#method.is_err). I briefly considered only generating these for `pub` types, but they seem small and unobtrusive enough that they're probably useful in the general case. Thanks! ## Example __input__ ```rust pub(crate) enum Variant { Undefined, Minor, // cursor here Major, } ``` __output__ ```rust pub(crate) enum Variant { Undefined, Minor, Major, } impl Variant { /// Returns `true` if the variant is [`Minor`]. pub(crate) fn is_minor(&self) -> bool { matches!(self, Self::Minor) } } ``` ## Future Directions This opens up the path to adding an assist for generating these comments on existing `is_` methods. This would make it both easy to document new code, and update existing code with documentation. 7571: Cleanup decl_check r=Veykril a=Veykril bors r+ Co-authored-by: Yoshua Wuyts <[email protected]> Co-authored-by: Lukas Wirth <[email protected]> | ||||
| | * | Cleanup decl_check | Lukas Wirth | 2021-02-05 | 1 | -160/+119 |
| |/ | |||||
* / | Remove unnecessary allocs in case_conv | Lukas Wirth | 2021-02-05 | 1 | -18/+16 |
|/ | |||||
* | Classify function calls as functions when shadowed by types | Lukas Wirth | 2021-01-28 | 1 | -9/+3 |
| | |||||
* | Update tests to register the required standard library types | Phil Ellison | 2021-01-23 | 1 | -6/+10 |
| | |||||
* | Identify methods using functions ids rather than string names | Phil Ellison | 2021-01-23 | 1 | -7/+27 |
| | |||||
* | Implement fix, add tests | Phil Ellison | 2021-01-23 | 1 | -20/+7 |
| | |||||
* | Add diagnostic for filter_map followed by next | Phil Ellison | 2021-01-23 | 1 | -9/+61 |
| | |||||
* | prepare to publish el libro de arena | Aleksey Kladov | 2021-01-14 | 1 | -1/+1 |
| | |||||
* | Fixed typos in local bindings | Vincent Esche | 2021-01-09 | 1 | -2/+2 |
| | |||||
* | Fixed typos in code comments | Vincent Esche | 2021-01-09 | 1 | -2/+2 |
| | |||||
* | cargo fmt | Phil Ellison | 2021-01-07 | 1 | -6/+9 |
| | |||||
* | Add fix to wrap return expression in Some | Phil Ellison | 2021-01-07 | 1 | -6/+16 |
| | |||||
* | Don't emit arg count diagnostics for method calls with unknown receiver | Florian Diebold | 2021-01-01 | 1 | -1/+25 |
| | | | | Fixes #7098. | ||||
* | decl_check: don't pass `db` around so often | Jonas Schievink | 2020-12-17 | 1 | -54/+49 |
| | |||||
* | Merge #6769 | bors[bot] | 2020-12-10 | 1 | -3/+36 |
|\ | | | | | | | | | | | | | | | | | | | 6769: Add native "remove this semicolon" diagnostics r=matklad a=ivan770 Closes #6739 ![demo2](https://user-images.githubusercontent.com/14003886/101530533-b76c3180-399a-11eb-9d18-5c8457721655.gif) Co-authored-by: ivan770 <[email protected]> | ||||
| * | Cast to ExprStmt, style fixes | ivan770 | 2020-12-10 | 1 | -6/+5 |
| | | |||||
| * | Apply rustfmt changes | ivan770 | 2020-12-09 | 1 | -9/+8 |
| | | |||||
| * | Apply suggestions from code review | ivan770 | 2020-12-09 | 1 | -17/+20 |
| | | | | | | Co-authored-by: bjorn3 <[email protected]> | ||||
| * | Format code | ivan770 | 2020-12-08 | 1 | -4/+13 |
| | | |||||
| * | Remove use via super | ivan770 | 2020-12-08 | 1 | -3/+1 |
| | | |||||
| * | Remove this semicolon | ivan770 | 2020-12-08 | 1 | -1/+26 |
| | | |||||
* | | Use mark/hit | Jonas Schievink | 2020-12-10 | 1 | -0/+7 |
| | | |||||
* | | Ignore extern items in incorrect-case check | Jonas Schievink | 2020-12-10 | 1 | -0/+19 |
|/ | |||||
* | Check structs for match exhaustiveness | Lukas Wirth | 2020-11-24 | 1 | -31/+120 |
| | |||||
* | Add middle ellipsis missing arm text | Lukas Wirth | 2020-11-24 | 1 | -0/+14 |
| | |||||
* | Handle ellipsis in tuple patterns in match exhaustiveness checking | Lukas Wirth | 2020-11-24 | 1 | -42/+41 |
| | |||||
* | Improve decl_check module readability | Igor Aleksanov | 2020-11-03 | 1 | -6/+6 |
| | |||||
* | Remove numbers from comments in decl_check.rs | Igor Aleksanov | 2020-11-03 | 1 | -15/+15 |
| | |||||
* | Check for allow(..) attributes for case diagnostic | Igor Aleksanov | 2020-11-03 | 1 | -25/+91 |
| | |||||
* | Deny unreachable-pub | Aleksey Kladov | 2020-11-02 | 3 | -18/+11 |
| | | | | | | | | It's very useful when `pub` is equivalent to "this is crate's public API", let's enforce this! Ideally, we should enforce it for local `cargo test`, and only during CI, but that needs https://github.com/rust-lang/cargo/issues/5034. | ||||
* | Make IncorrectDiagnostic match rustc by copying rustc's code. | Arif Roktim | 2020-10-25 | 1 | -126/+123 |
| | |||||
* | Merge #6319 | bors[bot] | 2020-10-22 | 2 | -3/+34 |
|\ | | | | | | | | | | | | | | | 6319: Properly identify camel cased acronyms as UpperCamelCase r=popzxc a=ArifRoktim This closes #6305. Co-authored-by: Arif Roktim <[email protected]> | ||||
| * | Properly identify camel cased acronyms as UpperCamelCase | Arif Roktim | 2020-10-21 | 2 | -3/+34 |
| | | |||||
* | | Move safe intrinsic tests | Francesco Zardi | 2020-10-21 | 1 | -0/+18 |
|/ | |||||
* | Keep SyntaxNodePtr::range private | Igor Aleksanov | 2020-10-12 | 1 | -2/+11 |
| | |||||
* | Replace 'if let' with 'match' in decl_check.rs | Igor Aleksanov | 2020-10-12 | 1 | -30/+33 |
| | |||||
* | Add to_upper_snake_case function to stdx | Igor Aleksanov | 2020-10-12 | 2 | -4/+3 |
| | |||||
* | Fix compilation error | Igor Aleksanov | 2020-10-12 | 1 | -2/+1 |
| | |||||
* | Apply suggestions from code review | Igor Aleksanov | 2020-10-12 | 1 | -2/+2 |
| | | | Co-authored-by: Lukas Wirth <[email protected]> | ||||
* | Fix code style issues | Igor Aleksanov | 2020-10-12 | 1 | -2/+6 |
| | |||||
* | Fix issues with match arm bindings | Igor Aleksanov | 2020-10-12 | 1 | -7/+12 |
| | |||||
* | Code style adjustments | Igor Aleksanov | 2020-10-12 | 3 | -8/+88 |
| | |||||
* | Make incorrect case diagnostic work inside of functions | Igor Aleksanov | 2020-10-12 | 1 | -32/+245 |
| | |||||
* | Refactor string helpers for decl_check module | Igor Aleksanov | 2020-10-12 | 1 | -32/+97 |
| | |||||
* | Add diagnostics for enum names and variants | Igor Aleksanov | 2020-10-12 | 1 | -1/+146 |
| | |||||
* | Improve string helpers functions | Igor Aleksanov | 2020-10-12 | 1 | -1/+8 |
| | |||||
* | Check structure fields to be snake_case | Igor Aleksanov | 2020-10-12 | 1 | -46/+65 |
| | |||||
* | Add check for structure names to be CamelCase | Igor Aleksanov | 2020-10-12 | 1 | -0/+138 |
| | |||||
* | Extract helper functions into a separate module | Igor Aleksanov | 2020-10-12 | 2 | -29/+112 |
| |