Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4135da4

Browse files
authored
Fix clippy (RustPython#5083)
* Fix clippy* Fix nightly clippy
1 parentd975c51 commit4135da4

File tree

9 files changed

+24
-29
lines changed

9 files changed

+24
-29
lines changed

‎compiler/codegen/src/symboltable.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ impl SymbolTableAnalyzer {
297297
&mutself,
298298
symbol:&mutSymbol,
299299
st_typ:SymbolTableType,
300-
sub_tables:&mut[SymbolTable],
300+
sub_tables:&[SymbolTable],
301301
) ->SymbolTableResult{
302302
if symbol
303303
.flags

‎src/shell/helper.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ impl<'vm> ShellHelper<'vm> {
119119
// only the completions that don't start with a '_'
120120
let no_underscore = all_completions
121121
.iter()
122+
.filter(|&s| !s.as_str().starts_with('_'))
122123
.cloned()
123-
.filter(|s| !s.as_str().starts_with('_'))
124124
.collect::<Vec<_>>();
125125

126126
// if there are only completions that start with a '_', give them all of the

‎stdlib/src/zlib.rs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ mod zlib {
310310

311311
fnsave_unused_input(
312312
&self,
313-
d:&mutDecompress,
313+
d:&Decompress,
314314
data:&[u8],
315315
stream_end:bool,
316316
orig_in:u64,
@@ -349,7 +349,7 @@ mod zlib {
349349
Ok((buf,false)) =>(Ok(buf),false),
350350
Err(err) =>(Err(err),false),
351351
};
352-
self.save_unused_input(&mutd, data, stream_end, orig_in, vm);
352+
self.save_unused_input(&d, data, stream_end, orig_in, vm);
353353

354354
let leftover =if stream_end{
355355
b""
@@ -390,7 +390,7 @@ mod zlib {
390390
Ok((buf, stream_end)) =>(Ok(buf), stream_end),
391391
Err(err) =>(Err(err),false),
392392
};
393-
self.save_unused_input(&mutd,&data, stream_end, orig_in, vm);
393+
self.save_unused_input(&d,&data, stream_end, orig_in, vm);
394394

395395
*data =PyBytes::from(Vec::new()).into_ref(&vm.ctx);
396396

‎vm/src/frame.rs‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1946,22 +1946,18 @@ impl ExecutingFrame<'_> {
19461946
impl fmt::DebugforFrame{
19471947
fnfmt(&self,f:&mut fmt::Formatter) -> fmt::Result{
19481948
let state =self.state.lock();
1949-
let stack_str = state
1950-
.stack
1951-
.iter()
1952-
.map(|elem|{
1953-
if elem.payload_is::<Frame>(){
1954-
"\n > {frame}".to_owned()
1955-
}else{
1956-
format!("\n > {elem:?}")
1957-
}
1958-
})
1959-
.collect::<String>();
1960-
let block_str = state
1961-
.blocks
1962-
.iter()
1963-
.map(|elem|format!("\n > {elem:?}"))
1964-
.collect::<String>();
1949+
let stack_str = state.stack.iter().fold(String::new(), |mut s, elem|{
1950+
if elem.payload_is::<Frame>(){
1951+
s.push_str("\n > {frame}");
1952+
}else{
1953+
std::fmt::write(&mut s,format_args!("\n > {elem:?}")).unwrap();
1954+
}
1955+
s
1956+
});
1957+
let block_str = state.blocks.iter().fold(String::new(), |mut s, elem|{
1958+
std::fmt::write(&mut s,format_args!("\n > {elem:?}")).unwrap();
1959+
s
1960+
});
19651961
// TODO: fix this up
19661962
let locals =self.locals.clone();
19671963
write!(

‎vm/src/import.rs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,7 @@ pub(crate) fn init_importlib_base(vm: &mut VirtualMachine) -> PyResult<PyObjectR
3131
Ok(importlib)
3232
}
3333

34-
pub(crate)fninit_importlib_package(
35-
vm:&mutVirtualMachine,
36-
importlib:PyObjectRef,
37-
) ->PyResult<()>{
34+
pub(crate)fninit_importlib_package(vm:&VirtualMachine,importlib:PyObjectRef) ->PyResult<()>{
3835
thread::enter_vm(vm, ||{
3936
flame_guard!("install_external");
4037

‎vm/src/macros.rs‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,12 @@ macro_rules! match_class {
116116

117117
// The default arm, binding the original object to the specified identifier.
118118
(match($obj:expr){ $binding:ident => $default:expr $(,)?}) =>{{
119+
#[allow(clippy::redundant_locals)]
119120
let $binding = $obj;
120121
$default
121122
}};
122123
(match($obj:expr){ ref $binding:ident => $default:expr $(,)?}) =>{{
124+
#[allow(clippy::redundant_locals)]
123125
let $binding =&$obj;
124126
$default
125127
}};

‎vm/src/stdlib/ast.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn range_from_object(
168168
None
169169
};
170170
let range =SourceRange{
171-
start: location.unwrap_or(SourceLocation::default()),
171+
start: location.unwrap_or_default(),
172172
end: end_location,
173173
};
174174
Ok(range)

‎vm/src/stdlib/sys.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,8 @@ mod sys {
784784
implPyThreadInfo{
785785
constINFO:Self =PyThreadInfo{
786786
name:crate::stdlib::thread::_thread::PYTHREAD_NAME,
787-
/// As I know, there's only way to use lock as "Mutex" in Rust
788-
/// with satisfying python document spec.
787+
// As I know, there's only way to use lock as "Mutex" in Rust
788+
// with satisfying python document spec.
789789
lock:Some("mutex+cond"),
790790
version:None,
791791
};

‎wasm/lib/src/lib.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ pub mod eval {
5252

5353
fnrun_py(source:&str,options:Option<Object>,mode:Mode) ->Result<JsValue,JsValue>{
5454
let vm =VMStore::init(PY_EVAL_VM_ID.into(),Some(true));
55-
let options = options.unwrap_or_else(Object::new);
55+
let options = options.unwrap_or_default();
5656
let js_vars ={
5757
let prop =Reflect::get(&options,&"vars".into())?;
5858
if prop.is_undefined(){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp