Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sugg structured snippet modifications wishlist #3683

Closed
oli-obk opened this issue Jan 21, 2019 · 0 comments
Closed

Sugg structured snippet modifications wishlist #3683

oli-obk opened this issue Jan 21, 2019 · 0 comments
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@oli-obk
Copy link
Contributor

oli-obk commented Jan 21, 2019

Our Sugg builder type has support for many code snippets, but in some cases we still fall back to strings. One such case is

format!("return {}", snip)
} else {
snip.to_string()
};
if parent_node_is_if_expr(&e, &cx) {
hint = format!("{{ {} }}", hint);

There are probably more, but for now we should add methods for

  • return $sugg (e.g. a return_expr method that wraps the current suggestion in a return call)
  • blockifying (turns the current suggestion into a block where the current suggestion is the trailing expression)
@oli-obk oli-obk added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Jan 21, 2019
bors added a commit that referenced this issue Jan 22, 2019
"make_return" and "blockify" convenience methods, fixes #3683

…ed them in "needless_bool".
flip1995 added a commit to flip1995/rust-clippy that referenced this issue Jan 22, 2019
…ns, r=oli-obk

"make_return" and "blockify" convenience methods, fixes rust-lang#3683

…ed them in "needless_bool".
bors added a commit that referenced this issue Jan 22, 2019
Rollup of 4 pull requests

Successful merges:

 - #3582 (Add assert(true) and assert(false) lints)
 - #3679 (Fix automatic suggestion on `use_self`.)
 - #3684 ("make_return" and "blockify" convenience methods, fixes #3683)
 - #3685 (Rustup)

Failed merges:

r? @ghost
bors added a commit that referenced this issue Jan 22, 2019
"make_return" and "blockify" convenience methods, fixes #3683

…ed them in "needless_bool".
@bors bors closed this as completed in a069320 Jan 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant