Skip to content

Commit a71aa99

Browse files
committed
Cleanup
- Revert unused changes - Remove unused lifetime parameter - Don't needless repeat full path
1 parent d868f01 commit a71aa99

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/clang.rs

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use crate::ir::context::BindgenContext;
88
use clang_sys::*;
9-
use regex;
109
use std::ffi::{CStr, CString};
1110
use std::fmt;
1211
use std::hash::Hash;
@@ -696,7 +695,7 @@ impl Cursor {
696695
}
697696

698697
/// Gets the tokens that correspond to that cursor as `rcc` tokens.
699-
pub fn rcc_tokens<'a>(self) -> Vec<rcc::Locatable<rcc::Token>> {
698+
pub fn rcc_tokens(self) -> Vec<rcc::Locatable<rcc::Token>> {
700699
use rcc::{Literal, Token, Files, Lexer};
701700

702701
self.tokens()
@@ -803,7 +802,6 @@ impl<'a> Drop for RawTokens<'a> {
803802
/// string.
804803
#[derive(Debug)]
805804
pub struct ClangToken {
806-
raw: CXToken,
807805
spelling: CXString,
808806
/// The kind of token, this is the same as the relevant member from
809807
/// `CXToken`.
@@ -836,20 +834,11 @@ impl<'a> Iterator for ClangTokenIterator<'a> {
836834
type Item = ClangToken;
837835

838836
fn next(&mut self) -> Option<Self::Item> {
839-
let raw = *self.raw.next()?;
837+
let raw = self.raw.next()?;
840838
unsafe {
841-
let kind = clang_getTokenKind(raw);
842-
let spelling = clang_getTokenSpelling(self.tu, raw);
843-
Some(ClangToken { raw, kind, spelling })
844-
}
845-
}
846-
}
847-
848-
impl ClangTokenIterator<'_> {
849-
/// Get the location of a token (prior to macro expansion)
850-
pub fn span(&self, raw: CXToken) -> CXSourceRange {
851-
unsafe {
852-
clang_getTokenExtent(self.tu, raw)
839+
let kind = clang_getTokenKind(*raw);
840+
let spelling = clang_getTokenSpelling(self.tu, *raw);
841+
Some(ClangToken { kind, spelling })
853842
}
854843
}
855844
}

src/ir/context.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ pub struct BindgenContext {
352352
/// expression parsing.
353353
///
354354
/// This needs to be an std::HashMap because the rcc API requires it.
355-
parsed_macros: StdHashMap<rcc::InternedStr, rcc::Definition>,
355+
parsed_macros: StdHashMap<InternedStr, rcc::Definition>,
356356

357357
/// The active replacements collected from replaces="xxx" annotations.
358358
replacements: HashMap<Vec<String>, ItemId>,

0 commit comments

Comments
 (0)