File tree 5 files changed +23
-17
lines changed
5 files changed +23
-17
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,8 @@ jobs:
118
118
path : compiler/parser/python.rs
119
119
key : lalrpop-${{ hashFiles('compiler/parser/python.lalrpop') }}
120
120
- uses : dtolnay/rust-toolchain@stable
121
+ with :
122
+ components : clippy
121
123
- name : Set up the Windows environment
122
124
shell : bash
123
125
run : |
@@ -128,6 +130,10 @@ jobs:
128
130
run : brew install autoconf automake libtool
129
131
if : runner.os == 'macOS'
130
132
- uses : Swatinem/rust-cache@v1
133
+
134
+ - name : run clippy
135
+ run : cargo clippy ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
136
+
131
137
- name : run rust tests
132
138
run : cargo test --workspace --exclude rustpython_wasm --verbose --features threading ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }}
133
139
- name : check compilation without threading
@@ -331,8 +337,6 @@ jobs:
331
337
components : rustfmt, clippy
332
338
- name : run rustfmt
333
339
run : cargo fmt --all -- --check
334
- - name : run clippy
335
- run : cargo clippy ${{ env.CARGO_ARGS }} ${{ env.NON_WASM_PACKAGES }} -- -Dwarnings
336
340
- name : run clippy on wasm
337
341
run : cargo clippy --manifest-path=wasm/lib/Cargo.toml -- -Dwarnings
338
342
- uses : actions/setup-python@v2
Original file line number Diff line number Diff line change @@ -163,22 +163,24 @@ mod fcntl {
163
163
whence : OptionalArg < i32 > ,
164
164
vm : & VirtualMachine ,
165
165
) -> PyResult {
166
+ macro_rules! try_into_l_type {
167
+ ( $l_type: path) => {
168
+ $l_type
169
+ . try_into( )
170
+ . map_err( |e| vm. new_overflow_error( format!( "{e}" ) ) )
171
+ } ;
172
+ }
173
+
166
174
let mut l: libc:: flock = unsafe { std:: mem:: zeroed ( ) } ;
167
- if cmd == libc:: LOCK_UN {
168
- l. l_type = libc:: F_UNLCK
169
- . try_into ( )
170
- . map_err ( |e| vm. new_overflow_error ( format ! ( "{e}" ) ) ) ?;
175
+ l. l_type = if cmd == libc:: LOCK_UN {
176
+ try_into_l_type ! ( libc:: F_UNLCK )
171
177
} else if ( cmd & libc:: LOCK_SH ) != 0 {
172
- l. l_type = libc:: F_RDLCK
173
- . try_into ( )
174
- . map_err ( |e| vm. new_overflow_error ( format ! ( "{e}" ) ) ) ?;
178
+ try_into_l_type ! ( libc:: F_RDLCK )
175
179
} else if ( cmd & libc:: LOCK_EX ) != 0 {
176
- l. l_type = libc:: F_WRLCK
177
- . try_into ( )
178
- . map_err ( |e| vm. new_overflow_error ( format ! ( "{e}" ) ) ) ?;
180
+ try_into_l_type ! ( libc:: F_WRLCK )
179
181
} else {
180
182
return Err ( vm. new_value_error ( "unrecognized lockf argument" . to_owned ( ) ) ) ;
181
- }
183
+ } ? ;
182
184
l. l_start = match start {
183
185
OptionalArg :: Present ( s) => s. try_to_primitive ( vm) ?,
184
186
OptionalArg :: Missing => 0 ,
Original file line number Diff line number Diff line change @@ -1445,7 +1445,7 @@ mod windows {
1445
1445
. iter ( )
1446
1446
. filter_map ( |open| open ( store_name. as_str ( ) ) . ok ( ) )
1447
1447
. collect :: < Vec < _ > > ( ) ;
1448
- let certs = stores. iter ( ) . map ( |s| s. certs ( ) ) . flatten ( ) . map ( |c| {
1448
+ let certs = stores. iter ( ) . flat_map ( |s| s. certs ( ) ) . map ( |c| {
1449
1449
let cert = vm. ctx . new_bytes ( c. to_der ( ) . to_owned ( ) ) ;
1450
1450
let enc_type = unsafe {
1451
1451
let ptr = c. as_ptr ( ) as wincrypt:: PCCERT_CONTEXT ;
Original file line number Diff line number Diff line change @@ -431,6 +431,6 @@ mod _winapi {
431
431
}
432
432
433
433
let ( path, _) = path. split_at ( length as usize ) ;
434
- Ok ( String :: from_utf16 ( & path) . unwrap ( ) )
434
+ Ok ( String :: from_utf16 ( path) . unwrap ( ) )
435
435
}
436
436
}
Original file line number Diff line number Diff line change @@ -191,7 +191,7 @@ mod winreg {
191
191
key. with_key ( |k| k. get_raw_value ( subkey) )
192
192
. map_err ( |e| e. to_pyexception ( vm) )
193
193
. and_then ( |regval| {
194
- let ty = regval. vtype . clone ( ) as usize ;
194
+ let ty = regval. vtype as usize ;
195
195
Ok ( ( reg_to_py ( regval, vm) ?, ty) )
196
196
} )
197
197
}
@@ -221,7 +221,7 @@ mod winreg {
221
221
} )
222
222
. map_err ( |e| e. to_pyexception ( vm) )
223
223
. and_then ( |( name, value) | {
224
- let ty = value. vtype . clone ( ) as usize ;
224
+ let ty = value. vtype as usize ;
225
225
Ok ( ( name, reg_to_py ( value, vm) ?, ty) )
226
226
} )
227
227
}
You can’t perform that action at this time.
0 commit comments