Skip to content

Commit 6ec33c1

Browse files
authored
Merge pull request #86 from blas-lapack-rs/clippy-fix
Fix by cargo-clippy
2 parents 52de2ef + 99d7cfc commit 6ec33c1

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

.github/workflows/openblas-src.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ jobs:
6161
if: ${{ matrix.triple == 'x64-windows-static' }}
6262

6363
macos:
64-
runs-on: macos-10.15
64+
runs-on: macos-11
6565
strategy:
6666
fail-fast: false
6767
matrix:

.github/workflows/rust.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request: {}
8+
9+
jobs:
10+
check-format:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: actions-rs/cargo@v1
15+
with:
16+
command: fmt
17+
args: -- --check
18+
19+
clippy:
20+
runs-on: ubuntu-22.04
21+
steps:
22+
- uses: actions/checkout@v1
23+
with:
24+
submodules: 'true'
25+
- uses: actions-rs/cargo@v1
26+
with:
27+
command: clippy

openblas-build/src/check.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl LinkFlags {
3838
pub fn parse(line: &str) -> Result<Self, Error> {
3939
let mut search_paths = HashSet::new();
4040
let mut libs = HashSet::new();
41-
for entry in line.split(" ") {
41+
for entry in line.split(' ') {
4242
if entry.starts_with("-L") {
4343
let path = PathBuf::from(entry.trim_start_matches("-L"));
4444
if !path.exists() {
@@ -79,10 +79,10 @@ impl MakeConf {
7979
let buf = io::BufReader::new(f);
8080
for line in buf.lines() {
8181
let line = line.expect("Makefile.conf should not include non-UTF8 string");
82-
if line.len() == 0 {
82+
if line.is_empty() {
8383
continue;
8484
}
85-
let entry: Vec<_> = line.split("=").collect();
85+
let entry: Vec<_> = line.split('=').collect();
8686
if entry.len() != 2 {
8787
continue;
8888
}
@@ -104,7 +104,6 @@ impl MakeConf {
104104
/// - Global "T" symbols in the text (code) section of library using `nm -g` external command.
105105
#[derive(Debug, Clone)]
106106
pub struct LibInspect {
107-
path: PathBuf,
108107
pub libs: Vec<String>,
109108
pub symbols: Vec<String>,
110109
}
@@ -133,7 +132,7 @@ impl LibInspect {
133132
.lines()
134133
.flat_map(|line| {
135134
let line = line.expect("nm output should not include non-UTF8 output");
136-
let entry: Vec<_> = line.trim().split(" ").collect();
135+
let entry: Vec<_> = line.trim().split(' ').collect();
137136
if entry.len() == 3 && entry[1] == "T" {
138137
Some(entry[2].into())
139138
} else {
@@ -160,11 +159,7 @@ impl LibInspect {
160159
.collect();
161160
libs.sort();
162161

163-
Ok(LibInspect {
164-
path: path.into(),
165-
libs,
166-
symbols,
167-
})
162+
Ok(LibInspect { libs, symbols })
168163
}
169164

170165
pub fn has_cblas(&self) -> bool {
@@ -173,7 +168,7 @@ impl LibInspect {
173168
return true;
174169
}
175170
}
176-
return false;
171+
false
177172
}
178173

179174
pub fn has_lapack(&self) -> bool {
@@ -182,7 +177,7 @@ impl LibInspect {
182177
return true;
183178
}
184179
}
185-
return false;
180+
false
186181
}
187182

188183
pub fn has_lapacke(&self) -> bool {
@@ -191,18 +186,18 @@ impl LibInspect {
191186
return true;
192187
}
193188
}
194-
return false;
189+
false
195190
}
196191

197192
pub fn has_lib(&self, name: &str) -> bool {
198193
for lib in &self.libs {
199-
if let Some(stem) = lib.split(".").next() {
194+
if let Some(stem) = lib.split('.').next() {
200195
if stem == format!("lib{}", name) {
201196
return true;
202197
}
203198
};
204199
}
205-
return false;
200+
false
206201
}
207202
}
208203

openblas-src/build.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ fn build() {
127127
// It makes users not to build OpenBLAS in every `cargo build`.
128128
let mut hasher = DefaultHasher::new();
129129
cfg.hash(&mut hasher);
130-
let output = dirs::data_dir()
130+
131+
dirs::data_dir()
131132
.expect("Cannot get user's data directory")
132133
.join("openblas_build")
133-
.join(format!("{:x}", hasher.finish()));
134-
output
134+
.join(format!("{:x}", hasher.finish()))
135135
} else {
136136
PathBuf::from(env::var("OUT_DIR").unwrap())
137137
};

0 commit comments

Comments
 (0)