We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d975c51 commit 4135da4Copy full SHA for 4135da4
compiler/codegen/src/symboltable.rs
@@ -297,7 +297,7 @@ impl SymbolTableAnalyzer {
297
&mut self,
298
symbol: &mut Symbol,
299
st_typ: SymbolTableType,
300
- sub_tables: &mut [SymbolTable],
+ sub_tables: &[SymbolTable],
301
) -> SymbolTableResult {
302
if symbol
303
.flags
src/shell/helper.rs
@@ -119,8 +119,8 @@ impl<'vm> ShellHelper<'vm> {
119
// only the completions that don't start with a '_'
120
let no_underscore = all_completions
121
.iter()
122
+ .filter(|&s| !s.as_str().starts_with('_'))
123
.cloned()
- .filter(|s| !s.as_str().starts_with('_'))
124
.collect::<Vec<_>>();
125
126
// if there are only completions that start with a '_', give them all of the
stdlib/src/zlib.rs
@@ -310,7 +310,7 @@ mod zlib {
310
311
fn save_unused_input(
312
&self,
313
- d: &mut Decompress,
+ d: &Decompress,
314
data: &[u8],
315
stream_end: bool,
316
orig_in: u64,
@@ -349,7 +349,7 @@ mod zlib {
349
Ok((buf, false)) => (Ok(buf), false),
350
Err(err) => (Err(err), false),
351
};
352
- self.save_unused_input(&mut d, data, stream_end, orig_in, vm);
+ self.save_unused_input(&d, data, stream_end, orig_in, vm);
353
354
let leftover = if stream_end {
355
b""
@@ -390,7 +390,7 @@ mod zlib {
390
Ok((buf, stream_end)) => (Ok(buf), stream_end),
391
392
393
- self.save_unused_input(&mut d, &data, stream_end, orig_in, vm);
+ self.save_unused_input(&d, &data, stream_end, orig_in, vm);
394
395
*data = PyBytes::from(Vec::new()).into_ref(&vm.ctx);
396
vm/src/frame.rs
@@ -1946,22 +1946,18 @@ impl ExecutingFrame<'_> {
1946
impl fmt::Debug for Frame {
1947
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1948
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
1963
- .map(|elem| format!("\n > {elem:?}"))
1964
+ let stack_str = state.stack.iter().fold(String::new(), |mut s, elem| {
+ if elem.payload_is::<Frame>() {
+ s.push_str("\n > {frame}");
+ } else {
+ std::fmt::write(&mut s, format_args!("\n > {elem:?}")).unwrap();
+ }
+ s
+ });
+ let block_str = state.blocks.iter().fold(String::new(), |mut s, elem| {
1965
// TODO: fix this up
1966
let locals = self.locals.clone();
1967
write!(
vm/src/import.rs
@@ -31,10 +31,7 @@ pub(crate) fn init_importlib_base(vm: &mut VirtualMachine) -> PyResult<PyObjectR
31
Ok(importlib)
32
}
33
34
-pub(crate) fn init_importlib_package(
35
- vm: &mut VirtualMachine,
36
- importlib: PyObjectRef,
37
-) -> PyResult<()> {
+pub(crate) fn init_importlib_package(vm: &VirtualMachine, importlib: PyObjectRef) -> PyResult<()> {
38
thread::enter_vm(vm, || {
39
flame_guard!("install_external");
40
vm/src/macros.rs
@@ -116,10 +116,12 @@ macro_rules! match_class {
116
117
// The default arm, binding the original object to the specified identifier.
118
(match ($obj:expr) { $binding:ident => $default:expr $(,)? }) => {{
+ #[allow(clippy::redundant_locals)]
let $binding = $obj;
$default
}};
(match ($obj:expr) { ref $binding:ident => $default:expr $(,)? }) => {{
let $binding = &$obj;
127
vm/src/stdlib/ast.rs
@@ -168,7 +168,7 @@ fn range_from_object(
168
None
169
170
let range = SourceRange {
171
- start: location.unwrap_or(SourceLocation::default()),
+ start: location.unwrap_or_default(),
172
end: end_location,
173
174
Ok(range)
vm/src/stdlib/sys.rs
@@ -784,8 +784,8 @@ mod sys {
784
impl PyThreadInfo {
785
const INFO: Self = PyThreadInfo {
786
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.
+ // As I know, there's only way to use lock as "Mutex" in Rust
+ // with satisfying python document spec.
789
lock: Some("mutex+cond"),
790
version: None,
791
wasm/lib/src/lib.rs
@@ -52,7 +52,7 @@ pub mod eval {
52
53
fn run_py(source: &str, options: Option<Object>, mode: Mode) -> Result<JsValue, JsValue> {
54
let vm = VMStore::init(PY_EVAL_VM_ID.into(), Some(true));
55
- let options = options.unwrap_or_else(Object::new);
+ let options = options.unwrap_or_default();
56
let js_vars = {
57
let prop = Reflect::get(&options, &"vars".into())?;
58
if prop.is_undefined() {
0 commit comments