Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new Rust 1.83 clippy lints #198

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ jobs:
- name: install llvm macos
if: ${{ matrix.host == 'macos-latest' }}
run: |
brew install llvm
echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
brew install llvm lld
echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH

- name: install java
uses: actions/setup-java@v2
Expand Down
2 changes: 1 addition & 1 deletion apk/src/compiler/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ pub struct Entry<'a> {
entry: &'a ResTableEntry,
}

impl<'a> Entry<'a> {
impl Entry<'_> {
pub fn id(self) -> ResTableRef {
self.id
}
Expand Down
2 changes: 1 addition & 1 deletion apk/src/res.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ impl Chunk {
break;
}
}
let s = String::from_utf16(unsafe { std::mem::transmute(buf.as_slice()) })?;
let s = String::from_utf16(buf.as_slice())?;
strings.push(s);
}
}
Expand Down
4 changes: 2 additions & 2 deletions mvn/src/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub struct Artifact<'a> {
pub version: &'a Version,
}

impl<'a> Artifact<'a> {
impl Artifact<'_> {
pub fn file_name(self, ext: &str) -> String {
format!(
"{}-{}-{}.{}",
Expand All @@ -163,7 +163,7 @@ impl<'a> Artifact<'a> {
}
}

impl<'a> std::fmt::Display for Artifact<'a> {
impl std::fmt::Display for Artifact<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(
f,
Expand Down
6 changes: 1 addition & 5 deletions mvn/src/pom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ pub struct Pom {

impl Pom {
pub fn packaging(&self) -> &str {
if let Some(s) = self.packaging.as_deref() {
s
} else {
"jar"
}
self.packaging.as_deref().unwrap_or("jar")
}

pub fn dependencies(&self) -> &[Dependency] {
Expand Down
4 changes: 2 additions & 2 deletions xbuild/src/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub struct DownloadManager<'a> {
client: Client,
}

impl<'a> Download for DownloadManager<'a> {
impl Download for DownloadManager<'_> {
fn download(&self, url: &str, dest: &Path) -> Result<()> {
let pb = ProgressBar::with_draw_target(Some(0), ProgressDrawTarget::stdout())
.with_style(
Expand Down Expand Up @@ -233,7 +233,7 @@ impl WorkItem {
}
}

impl<'a> DownloadManager<'a> {
impl DownloadManager<'_> {
pub fn android_jar(&self) -> Result<()> {
let dir = self.env.android_sdk();
let sdk = self.env.target_sdk_version();
Expand Down
2 changes: 1 addition & 1 deletion xcommon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ fn find_cde_start_pos<R: Read + Seek>(reader: &mut R) -> Result<u64> {
const CENTRAL_DIRECTORY_END_SIGNATURE: u32 = 0x06054b50;
const HEADER_SIZE: u64 = 22;
let file_length = reader.seek(SeekFrom::End(0))?;
let search_upper_bound = file_length.saturating_sub(HEADER_SIZE + ::std::u16::MAX as u64);
let search_upper_bound = file_length.saturating_sub(HEADER_SIZE + u16::MAX as u64);
anyhow::ensure!(file_length >= HEADER_SIZE, "Invalid zip header");
let mut pos = file_length - HEADER_SIZE;
while pos >= search_upper_bound {
Expand Down
Loading