Fix a number of lint perf and safety issues in torch (#59897)

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/59897

Test Plan: Sandcastle

Reviewed By: ngimel

Differential Revision: D29037012

fbshipit-source-id: 7c16286d5fc2b67964fb65f8374dfff4d1a7aefb
This commit is contained in:
Richard Barnes
2021-06-15 13:13:43 -07:00
committed by Facebook GitHub Bot
parent a0e62c4da4
commit b162d95e46
44 changed files with 110 additions and 167 deletions

View File

@ -474,8 +474,7 @@ struct Lexer {
break;
case TK_WHITESPACE:
case TK_WHITESPACE_EOF: {
int depth =
// NOLINTNEXTLINE(cppcoreguidelines-narrowing-conversions,bugprone-narrowing-conversions)
const auto depth =
r.kind == TK_WHITESPACE_EOF ? indent_stack.front() : r.range.size();
// note: TK_WHITESPACE_EOF is whitespace right before the EOF token
// just like we allow the code to be indented to a particular initial