-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Remove unused imports, and deprecated function usage #18663
Conversation
compiler/docgen.nim
Outdated
@@ -835,15 +835,15 @@ proc docstringSummary(rstText: string): string = | |||
result = rstText.substr(2).strip | |||
var pos = result.find('\L') | |||
if pos > 0: | |||
result.delete(pos, result.len - 1) | |||
result = result[0 .. pos] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
buggy patch and allocates un-necessarily
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My mistake on the allocation. Slices can be done in place, so my mistake on that. Can you elaborate on "buggy"? It should achieve the same result as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
off by 1 error, try it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I came from python, and read up on the differences. Thank you for your patience.
EDIT: I'm reverting this change as even after getting the correct slice result 0 ..< pos
I still could not avoid the assignment. Will simplify the PR to only deleting unused imports.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not simply use result.setLen(pos - 1)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That does in fact do that both in place, and do the same thing. Thank you again for helping me learn about these things, and being patient.
* clean up imports and slice to remove delete * revert buggy code * Replace "delete" with setlen to remove depreciation warning
Compiler warned of unused imports.