Skip to content

Commit 587fd84

Browse files
xbjfktgross35
authored andcommitted
libc-test: delete handle_s_macro_no_attrs
Unfortunately does not seem to handle cfg_if well
1 parent 75fb1f0 commit 587fd84

File tree

2 files changed

+1
-35
lines changed

2 files changed

+1
-35
lines changed

libc-test/tests/style_lib/mod.rs

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -242,25 +242,6 @@ impl StyleChecker {
242242
self.state = initial_state;
243243
}
244244

245-
/// If we see a normal s! macro without any attributes we just need
246-
/// to check if there are any duplicates.
247-
fn handle_s_macro_no_attrs(&mut self, item_macro: &syn::ItemMacro) {
248-
let span = item_macro.span();
249-
match self.seen_s_macro_cfgs.get("") {
250-
Some(seen_span) => {
251-
self.error(
252-
"duplicate s! macro".to_string(),
253-
span,
254-
format!("other s! macro"),
255-
(Some(*seen_span), "combine the two".to_string()),
256-
);
257-
}
258-
None => {
259-
self.seen_s_macro_cfgs.insert(String::new(), span);
260-
}
261-
}
262-
}
263-
264245
/// If an s! macro has attributes we check for any duplicates as well
265246
/// as if they are standalone positive cfgs that would be better
266247
/// in a separate file.
@@ -367,9 +348,7 @@ impl<'ast> Visit<'ast> for StyleChecker {
367348
/// instead of [syn::Macro] because it contains the attributes.
368349
fn visit_item_macro(&mut self, item_macro: &'ast syn::ItemMacro) {
369350
if item_macro.mac.path.is_ident("s") {
370-
if item_macro.attrs.is_empty() {
371-
self.handle_s_macro_no_attrs(item_macro);
372-
} else {
351+
if !item_macro.attrs.is_empty() {
373352
self.handle_s_macro_with_attrs(item_macro);
374353
}
375354
}

libc-test/tests/style_tests.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,6 @@ s! { pub struct bar { /* ... */ } }
154154
checker.finalize().unwrap();
155155
}
156156

157-
#[test]
158-
fn check_style_reject_duplicated_s_macro() {
159-
let contents = r#"
160-
s! {}
161-
s! {}
162-
"#
163-
.to_string();
164-
165-
let mut checker = StyleChecker::new();
166-
checker.check_string(contents).unwrap();
167-
assert!(checker.finalize().is_err());
168-
}
169-
170157
#[test]
171158
fn check_style_reject_duplicated_s_macro_cfg() {
172159
let contents = r#"

0 commit comments

Comments
 (0)