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

Adapt is-macro for a few enums #3182

Merged
merged 8 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Minor tweaks
  • Loading branch information
charliermarsh committed Feb 24, 2023
commit 1068612c6b979aa73f940a083ff311bf99c9e0da
16 changes: 8 additions & 8 deletions crates/ruff/src/checkers/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4200,8 +4200,8 @@ impl<'a> Checker<'a> {

let scope = self.current_scope();
let binding = if let Some(index) = scope.bindings.get(&name) {
let b = &self.bindings[*index];
match &b.kind {
let existing = &self.bindings[*index];
match &existing.kind {
BindingKind::Builtin => {
// Avoid overriding builtins.
binding
Expand All @@ -4210,17 +4210,17 @@ impl<'a> Checker<'a> {
// If the original binding was a global or nonlocal, and the new binding conflicts within
// the current scope, then the new binding is also as the same.
Binding {
runtime_usage: b.runtime_usage,
synthetic_usage: b.synthetic_usage,
typing_usage: b.typing_usage,
runtime_usage: existing.runtime_usage,
synthetic_usage: existing.synthetic_usage,
typing_usage: existing.typing_usage,
kind: kind.clone(),
..binding
}
}
_ => Binding {
runtime_usage: b.runtime_usage,
synthetic_usage: b.synthetic_usage,
typing_usage: b.typing_usage,
runtime_usage: existing.runtime_usage,
synthetic_usage: existing.synthetic_usage,
typing_usage: existing.typing_usage,
..binding
},
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ruff/src/linter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ pub fn check_path(
|| settings
.rules
.iter_enabled()
.any(|rule_code| rule_code.lint_source().is_no_qa())
.any(|rule_code| rule_code.lint_source().is_noqa())
{
check_noqa(
&mut diagnostics,
Expand Down
4 changes: 2 additions & 2 deletions crates/ruff/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ pub enum LintSource {
LogicalLines,
Tokens,
Imports,
NoQa,
Noqa,
Filesystem,
}

Expand All @@ -776,7 +776,7 @@ impl Rule {
/// physical lines).
pub const fn lint_source(&self) -> &'static LintSource {
match self {
Rule::UnusedNOQA => &LintSource::NoQa,
Rule::UnusedNOQA => &LintSource::Noqa,
Rule::BlanketNOQA
| Rule::BlanketTypeIgnore
| Rule::DocLineTooLong
Expand Down