Skip to content

Commit

Permalink
clippy::cast_ref_to_mutに準拠する (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip authored Apr 2, 2023
1 parent 0315051 commit a19b447
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions crates/open_jtalk/src/mecab/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ impl Mecab {
}

pub fn get_feature_mut(&mut self) -> Option<&mut MecabFeature> {
self.get_feature().map(|feature| unsafe {
#[allow(clippy::cast_ref_to_mut)]
&mut *(feature as *const MecabFeature as *mut MecabFeature)
})
unsafe {
let feature = open_jtalk_sys::Mecab_get_feature(self.as_raw_ptr());
if !feature.is_null() {
Some(&mut *(feature as *mut MecabFeature))
} else {
None
}
}
}

pub fn analysis(&mut self, str: impl AsRef<str>) -> bool {
Expand Down

0 comments on commit a19b447

Please sign in to comment.