Skip to content

missing double quote in source example on master folder in large_include_file lint #8765

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

Closed
alexzanderr opened this issue Apr 30, 2022 · 13 comments · Fixed by #8767
Closed
Assignees

Comments

@alexzanderr
Copy link

alexzanderr commented Apr 30, 2022

Description

if you go on this url: https://rust-lang.github.io/rust-clippy/master/index.html#large_include_file

you will see that the source example has a missing ":

let included_str = include_str!("very_large_file.txt");
let included_bytes = include_bytes!("very_large_file.txt);
                                                       ^
                                                       |

error[E0765]: unterminated double quote string
 --> test.rs:5:37
  |
5 |   let included_bytes = include_bytes!("very_large_file.txt);
  |  _____________________________________^
6 | | }
  | |__^

please fix that, because im making a program that validates that source code and i need it to compile.

i know that its an insignificant issue, im sorry, but my program will fail.

so take your time.

Version

No response

Additional Labels

No response

@xFrednet
Copy link
Member

@rustbot claim

@xFrednet
Copy link
Member

Hey @alexzanderr, thank you for the report. I've created a PR to fix this. For your tool it would probably be good to ignore example code blocks that are marked with ignore.

Out of interest, would you mind providing some more information about the tool you're creating? It sounds interesting 🙃

@alexzanderr
Copy link
Author

cargo-clippy-explain

its a tool that does web scraping for a lint and gets the examples and explanations which then will be syntax highlighted and a little beautyfied in the terminal.

since the text in the artcile tag has no classes and no ids,
i need to identify which lines from example are valid rust source code, so im compiling the code to see if let some_vec = vec![0, 1, 2, 3]; its rust or not or if The correct use would be: its rust or not.

after some filtering and beautyfication, the output is printed to stdout.

this will get me and others understand how to write clean code, since understanding the clippy lints is key factor to write clean code, this tool its going to be great.

i just began to be rust dev.
i would love to help the community in all the ways.
i love rust. just moved from python.

@xFrednet
Copy link
Member

xFrednet commented Apr 30, 2022

In rustdoc everything is expected to be valid rust code unless a different language is specified. You could also try to use cargo collect-metadata in our repo, that will give you a json file with all lint information that is available over on Clippy's lint list

Edit: The most recent json and version specific jsons are also available online, see: https://github.com/rust-lang/rust-clippy/blob/gh-pages/master/lints.json

We actually also want to add the lint documentation to Clippy's TUI as well. @llogiq wanted to work on that AFAIK, see #8291. If you're interested, you could reach out to them and see if they have already started. Otherwise, it might be interesting to implement this in Clippy directly. However, due note that implementing this in Clippy directly, will most likely take a bit more effort than writing an external tool 🙃

If you have finished, feel free to share your tool, I'd be interested to see it 🙃

@alexzanderr
Copy link
Author

"In rust doc everything is expected to be valid rust code unless a different language is specified"

i dont mean that

look at this
image

how am i supposed to know which line is rust example and which line is just plain text that tells something if the source code in html is like this
image

i cannot scrape this! so i must develop an algorithm to detect what i want.

because i want to pretty format the code into some ascii tables and many more cool stuff.

@alexzanderr
Copy link
Author

how do i run this command cargo collect-metadata in your repo ?

bors added a commit that referenced this issue Apr 30, 2022
Add missing quite in `large_include_file` example

Roses are red,
violets are blue,
this fix,
was simple to do

Closes: #8765

changelog: None
@xFrednet
Copy link
Member

The JSON contains normal markdown, the rest is just styling. In markdown code blocks are marked with backticks like this:

Normal text that should be rendered as normal

```rs
^^^This starts syntax highlighting
// Rust code
vvv This stops syntax highlighting
```

@alexzanderr
Copy link
Author

before this convo, i havent looked at the json, was trying to scrape from the website

@xFrednet
Copy link
Member

xFrednet commented Apr 30, 2022

how do i run this command cargo collect-metadata in your repo ?

Just checkout the master and run cargo collect-metadata in the root directory that should so everything for you, including downloading the correct nightly compiler etc. Or you can fetch it online from: https://github.com/rust-lang/rust-clippy/blob/gh-pages/master/lints.json

@alexzanderr
Copy link
Author

If you have finished, feel free to share your tool, I'd be interested to see it upside_down_face

will be on github

after being a great tool, i will PR into default clippy

@alexzanderr
Copy link
Author

We actually also want to add the lint documentation to Clippy's TUI as well

you mean clippy CLI.

@xFrednet
Copy link
Member

you mean clippy CLI.

Yes, I mix up the terms sometimes 😅

@alexzanderr
Copy link
Author

we can talk on discord, instead of spamming here, you can add me here alexzander#5442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants