Skip to content

Commit

Permalink
Cleanup some deprecated, unused allows (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed May 9, 2024
1 parent 9866310 commit b7455eb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 51 deletions.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@

#![doc(html_root_url = "https://docs.rs/cc/1.0")]
#![cfg_attr(test, deny(warnings))]
#![allow(deprecated)]
#![deny(missing_docs)]

use std::borrow::Cow;
Expand Down
51 changes: 2 additions & 49 deletions src/windows/com.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.

#![allow(unused)]

use crate::windows::{
winapi::{IUnknown, Interface},
windows_sys::{
Expand All @@ -16,10 +14,9 @@ use crate::windows::{
};
use std::{
convert::TryInto,
ffi::{OsStr, OsString},
mem::ManuallyDrop,
ffi::OsString,
ops::Deref,
os::windows::ffi::{OsStrExt, OsStringExt},
os::windows::ffi::OsStringExt,
ptr::{null, null_mut},
slice::from_raw_parts,
};
Expand Down Expand Up @@ -48,19 +45,6 @@ where
assert!(!ptr.is_null());
ComPtr(ptr)
}
/// Casts up the inheritance chain
pub fn up<U>(self) -> ComPtr<U>
where
T: Deref<Target = U>,
U: Interface,
{
ComPtr(self.into_raw() as *mut U)
}
/// Extracts the raw pointer.
/// You are now responsible for releasing it yourself.
pub fn into_raw(self) -> *mut T {
ManuallyDrop::new(self).0
}
/// For internal use only.
fn as_unknown(&self) -> &IUnknown {
unsafe { &*(self.0 as *mut IUnknown) }
Expand Down Expand Up @@ -124,34 +108,3 @@ impl Drop for BStr {
unsafe { SysFreeString(self.0) };
}
}

pub trait ToWide {
fn to_wide(&self) -> Vec<u16>;
fn to_wide_null(&self) -> Vec<u16>;
}
impl<T> ToWide for T
where
T: AsRef<OsStr>,
{
fn to_wide(&self) -> Vec<u16> {
self.as_ref().encode_wide().collect()
}
fn to_wide_null(&self) -> Vec<u16> {
self.as_ref().encode_wide().chain(Some(0)).collect()
}
}
pub trait FromWide
where
Self: Sized,
{
fn from_wide(wide: &[u16]) -> Self;
fn from_wide_null(wide: &[u16]) -> Self {
let len = wide.iter().take_while(|&&c| c != 0).count();
Self::from_wide(&wide[..len])
}
}
impl FromWide for OsString {
fn from_wide(wide: &[u16]) -> OsString {
OsStringExt::from_wide(wide)
}
}
2 changes: 1 addition & 1 deletion src/windows/find_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ mod impl_ {
for subkey in key.iter().filter_map(|k| k.ok()) {
let val = subkey
.to_str()
.and_then(|s| s.trim_left_matches("v").replace('.', "").parse().ok());
.and_then(|s| s.trim_start_matches("v").replace('.', "").parse().ok());
let val = match val {
Some(s) => s,
None => continue,
Expand Down

0 comments on commit b7455eb

Please sign in to comment.