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

changes to library files can still bleed through subtly #86

Closed
ahl opened this issue Aug 14, 2020 · 1 comment · Fixed by #194
Closed

changes to library files can still bleed through subtly #86

ahl opened this issue Aug 14, 2020 · 1 comment · Fixed by #194

Comments

@ahl
Copy link

ahl commented Aug 14, 2020

Let me start by saying this isn't a big deal.

#85 (thank you!) removed $WORKSPACE-related line numbers, but the output can still change spuriously when library source files cross ⌊log_10⌋ boundaries. For example, in the output below, the file handler.rs just went over 1000 lines:

-   --> $DIR/bad_endpoint6.rs:22:8
-    |
-22  |     Ok(HttpResponseOk(Ret { "Oxide".to_string(), 0x1de }))
-    |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `Ret`
-    |
-   ::: $WORKSPACE/dropshot/src/handler.rs
-    |
-    | pub struct HttpResponseOk<T: JsonSchema + Serialize + Send + Sync + 'static>(
-    |                                           --------- required by this bound in `dropshot::handler::HttpResponseOk`
+    --> $DIR/bad_endpoint6.rs:22:8
+     |
+22   |     Ok(HttpResponseOk(Ret { "Oxide".to_string(), 0x1de }))
+     |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `serde::ser::Serialize` is not implemented for `Ret`
+     |
+    ::: $WORKSPACE/dropshot/src/handler.rs
+     |
+     | pub struct HttpResponseOk<T: JsonSchema + Serialize + Send + Sync + 'static>(
+     |                                           --------- required by this bound in `dropshot::handler::HttpResponseOk`

The only way that occurs to me to fix this would require multiple passes. I think the simplest option would be to post-process looking to see if all lines match ([ ]*-->|\d*[ ]*[ ]+ |[ ]*:::).*. In that case one could trim one or more ' 's from each line.

Happy to submit a PR 1. this is worth fixing and 2. that approach sounds reasonable.

@dtolnay
Copy link
Owner

dtolnay commented Aug 14, 2020

I would accept a PR to fix this. Around above this line you'd be able to scan forward whether every line until the next blank line matches your pattern, and if so, decide how many spaces to be removed. Save that in a field of Filter and every subsequent line could delete the first n spaces from the line, until reset to 0 by a blank line.

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

Successfully merging a pull request may close this issue.

2 participants