mirror of https://github.com/astral-sh/ruff
Remove unused overridden property (#2217)
This commit is contained in:
parent
4f3b63edd4
commit
f15c562a1c
|
|
@ -89,9 +89,6 @@ pub struct Scope<'a> {
|
||||||
pub uses_locals: bool,
|
pub uses_locals: bool,
|
||||||
/// A map from bound name to binding index.
|
/// A map from bound name to binding index.
|
||||||
pub values: FxHashMap<&'a str, usize>,
|
pub values: FxHashMap<&'a str, usize>,
|
||||||
/// A list of (name, index) pairs for bindings that were overridden in the
|
|
||||||
/// scope.
|
|
||||||
pub overridden: Vec<(&'a str, usize)>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Scope<'a> {
|
impl<'a> Scope<'a> {
|
||||||
|
|
@ -102,7 +99,6 @@ impl<'a> Scope<'a> {
|
||||||
import_starred: false,
|
import_starred: false,
|
||||||
uses_locals: false,
|
uses_locals: false,
|
||||||
values: FxHashMap::default(),
|
values: FxHashMap::default(),
|
||||||
overridden: Vec::new(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4508,11 +4508,7 @@ impl<'a> Checker<'a> {
|
||||||
.rules
|
.rules
|
||||||
.enabled(&Rule::TypingOnlyStandardLibraryImport)
|
.enabled(&Rule::TypingOnlyStandardLibraryImport)
|
||||||
{
|
{
|
||||||
for (.., index) in scope
|
for (.., index) in &scope.values {
|
||||||
.values
|
|
||||||
.iter()
|
|
||||||
.chain(scope.overridden.iter().map(|(a, b)| (a, b)))
|
|
||||||
{
|
|
||||||
let binding = &self.bindings[*index];
|
let binding = &self.bindings[*index];
|
||||||
|
|
||||||
if let Some(diagnostic) =
|
if let Some(diagnostic) =
|
||||||
|
|
@ -4549,11 +4545,7 @@ impl<'a> Checker<'a> {
|
||||||
let mut ignored: FxHashMap<BindingContext, Vec<UnusedImport>> =
|
let mut ignored: FxHashMap<BindingContext, Vec<UnusedImport>> =
|
||||||
FxHashMap::default();
|
FxHashMap::default();
|
||||||
|
|
||||||
for (name, index) in scope
|
for (name, index) in &scope.values {
|
||||||
.values
|
|
||||||
.iter()
|
|
||||||
.chain(scope.overridden.iter().map(|(a, b)| (a, b)))
|
|
||||||
{
|
|
||||||
let binding = &self.bindings[*index];
|
let binding = &self.bindings[*index];
|
||||||
|
|
||||||
let full_name = match &binding.kind {
|
let full_name = match &binding.kind {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue