Loading tools/pdl/src/ast.rs +2 −2 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ impl Decl { } } pub fn id(&self) -> Option<&String> { pub fn id(&self) -> Option<&str> { match self { Decl::Test { .. } => None, Decl::Checksum { id, .. } Loading Loading @@ -271,7 +271,7 @@ impl Field { } } pub fn id(&self) -> Option<&String> { pub fn id(&self) -> Option<&str> { match self { Field::Checksum { .. } | Field::Padding { .. } Loading tools/pdl/src/lint.rs +2 −2 Original line number Diff line number Diff line Loading @@ -369,7 +369,7 @@ impl<'d> PacketScope<'d> { // Check field shadowing. for f in self.fields.iter().map(|f| f.0.last().unwrap()) { if let Some(id) = f.id() { if let Some(prev) = self.all_fields.insert(id.clone(), f) { if let Some(prev) = self.all_fields.insert(id.to_string(), f) { result.push( Diagnostic::warning() .with_message(format!("declaration of `{}` shadows parent field", id)) Loading Loading @@ -1292,7 +1292,7 @@ impl File { // TODO: switch to try_insert when stable for decl in &self.declarations { if let Some(id) = decl.id() { if let Some(prev) = scope.typedef.insert(id.clone(), decl) { if let Some(prev) = scope.typedef.insert(id.to_string(), decl) { result.err_redeclared(id, decl.kind(), decl.loc(), prev.loc()) } } Loading Loading
tools/pdl/src/ast.rs +2 −2 Original line number Diff line number Diff line Loading @@ -240,7 +240,7 @@ impl Decl { } } pub fn id(&self) -> Option<&String> { pub fn id(&self) -> Option<&str> { match self { Decl::Test { .. } => None, Decl::Checksum { id, .. } Loading Loading @@ -271,7 +271,7 @@ impl Field { } } pub fn id(&self) -> Option<&String> { pub fn id(&self) -> Option<&str> { match self { Field::Checksum { .. } | Field::Padding { .. } Loading
tools/pdl/src/lint.rs +2 −2 Original line number Diff line number Diff line Loading @@ -369,7 +369,7 @@ impl<'d> PacketScope<'d> { // Check field shadowing. for f in self.fields.iter().map(|f| f.0.last().unwrap()) { if let Some(id) = f.id() { if let Some(prev) = self.all_fields.insert(id.clone(), f) { if let Some(prev) = self.all_fields.insert(id.to_string(), f) { result.push( Diagnostic::warning() .with_message(format!("declaration of `{}` shadows parent field", id)) Loading Loading @@ -1292,7 +1292,7 @@ impl File { // TODO: switch to try_insert when stable for decl in &self.declarations { if let Some(id) = decl.id() { if let Some(prev) = scope.typedef.insert(id.clone(), decl) { if let Some(prev) = scope.typedef.insert(id.to_string(), decl) { result.err_redeclared(id, decl.kind(), decl.loc(), prev.loc()) } } Loading