Skip to content

Commit 9c728df

Browse files
authored
Merge pull request RustPython#3516 from coolreader18/fix-ci
Fix doctests in ci
2 parents db3b312 + 1188369 commit 9c728df

File tree

11 files changed

+26
-26
lines changed

11 files changed

+26
-26
lines changed

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ opt-level = 3
7171

7272
[profile.test]
7373
opt-level = 3
74-
lto = "thin"
74+
# https://github.com/rust-lang/rust/issues/92869
75+
# lto = "thin"
7576

7677
[profile.bench]
7778
lto = true

common/src/boxvec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ pub struct Drain<'a, T> {
465465
}
466466

467467
unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
468-
unsafe impl<'a, T: Send> Send for Drain<'a, T> {}
468+
unsafe impl<'a, T: Sync> Send for Drain<'a, T> {}
469469

470470
impl<T> Iterator for Drain<'_, T> {
471471
type Item = T;

common/src/linked_list.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,9 @@ struct PointersInner<T> {
128128
_pin: PhantomPinned,
129129
}
130130

131+
unsafe impl<T: Send> Send for PointersInner<T> {}
132+
unsafe impl<T: Sync> Sync for PointersInner<T> {}
133+
131134
unsafe impl<T: Send> Send for Pointers<T> {}
132135
unsafe impl<T: Sync> Sync for Pointers<T> {}
133136

compiler/src/compile.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ struct CompileContext {
8888
}
8989

9090
#[derive(Debug, Clone, Copy, PartialEq)]
91+
#[allow(clippy::enum_variant_names)]
9192
enum FunctionContext {
9293
NoFunction,
9394
Function,

derive/src/util.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ impl ItemMetaInner {
102102
Err(syn::Error::new_spanned(
103103
ident,
104104
format!(
105-
"#[{}({})] is not one of allowed attributes [{}]",
106-
meta_ident.to_string(),
107-
name,
105+
"#[{meta_ident}({name})] is not one of allowed attributes [{}]",
108106
allowed_names.join(", ")
109107
),
110108
))
@@ -116,7 +114,7 @@ impl ItemMetaInner {
116114
if !lits.is_empty() {
117115
return Err(syn::Error::new_spanned(
118116
&meta_ident,
119-
format!("#[{}(..)] cannot contain literal", meta_ident.to_string()),
117+
format!("#[{meta_ident}(..)] cannot contain literal"),
120118
));
121119
}
122120

@@ -381,7 +379,7 @@ impl AttributeExt for Attribute {
381379
other.span(),
382380
format!(
383381
"#[{name}(...)] doesn't contain '{item}' to remove",
384-
name = other.get_ident().unwrap().to_string(),
382+
name = other.get_ident().unwrap(),
385383
item = item_name
386384
),
387385
)),

jit/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ impl UnTypedAbiValue {
286286
}
287287
}
288288

289+
// we don't actually ever touch CompiledCode til we drop it, it should be safe.
290+
// TODO: confirm with wasmtime ppl that it's not unsound?
291+
#[allow(clippy::non_send_fields_in_send_ty)]
289292
unsafe impl Send for CompiledCode {}
290293
unsafe impl Sync for CompiledCode {}
291294

vm/src/codecs.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,13 @@ fn namereplace_errors(err: PyObjectRef, vm: &VirtualMachine) -> PyResult<(String
455455
use std::fmt::Write;
456456
let c_u32 = c as u32;
457457
if let Some(c_name) = unicode_names2::name(c) {
458-
write!(out, "\\N{{{}}}", c_name.to_string()).unwrap();
458+
write!(out, "\\N{{{c_name}}}").unwrap();
459459
} else if c_u32 >= 0x10000 {
460-
write!(out, "\\U{:08x}", c_u32).unwrap();
460+
write!(out, "\\U{c_u32:08x}").unwrap();
461461
} else if c_u32 >= 0x100 {
462-
write!(out, "\\u{:04x}", c_u32).unwrap();
462+
write!(out, "\\u{c_u32:04x}").unwrap();
463463
} else {
464-
write!(out, "\\x{:02x}", c_u32).unwrap();
464+
write!(out, "\\x{c_u32:02x}").unwrap();
465465
}
466466
}
467467
Ok((out, range.end))

vm/src/exceptions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl VirtualMachine {
144144
}?;
145145

146146
match offer_suggestions(exc, vm) {
147-
Some(suggestions) => writeln!(output, ". Did you mean: '{}'?", suggestions.to_string()),
147+
Some(suggestions) => writeln!(output, ". Did you mean: '{suggestions}'?"),
148148
None => writeln!(output),
149149
}
150150
}

vm/src/format.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,7 @@ impl FormatSpec {
413413
},
414414
};
415415

416-
if raw_magnitude_string_result.is_err() {
417-
return raw_magnitude_string_result;
418-
}
419-
420-
let magnitude_string = self.add_magnitude_separators(raw_magnitude_string_result.unwrap());
416+
let magnitude_string = self.add_magnitude_separators(raw_magnitude_string_result?);
421417
let format_sign = self.sign.unwrap_or(FormatSign::Minus);
422418
let sign_str = if num.is_sign_negative() && !num.is_nan() {
423419
"-"
@@ -474,13 +470,10 @@ impl FormatSpec {
474470
},
475471
None => Ok(magnitude.to_str_radix(10)),
476472
};
477-
if raw_magnitude_string_result.is_err() {
478-
return raw_magnitude_string_result;
479-
}
480473
let magnitude_string = format!(
481474
"{}{}",
482475
prefix,
483-
self.add_magnitude_separators(raw_magnitude_string_result.unwrap())
476+
self.add_magnitude_separators(raw_magnitude_string_result?)
484477
);
485478

486479
let format_sign = self.sign.unwrap_or(FormatSign::Minus);

vm/src/pyobjectrc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ pub struct PyWeak {
307307

308308
cfg_if::cfg_if! {
309309
if #[cfg(feature = "threading")] {
310+
#[allow(clippy::non_send_fields_in_send_ty)] // false positive?
310311
unsafe impl Send for PyWeak {}
311312
unsafe impl Sync for PyWeak {}
312313
}
@@ -819,7 +820,7 @@ fn print_del_error(e: PyBaseExceptionRef, zelf: &PyObject, vm: &VirtualMachine)
819820
let del_method = zelf.get_class_attr("__del__").unwrap();
820821
let repr = &del_method.repr(vm);
821822
match repr {
822-
Ok(v) => println!("{}", v.to_string()),
823+
Ok(v) => println!("{v}"),
823824
Err(_) => println!("{}", del_method.class().name()),
824825
}
825826
let tb_module = vm.import("traceback", None, 0).unwrap();

vm/src/vm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,10 +1956,6 @@ impl<'vm> Drop for ReprGuard<'vm> {
19561956
}
19571957
}
19581958

1959-
pub struct Interpreter {
1960-
vm: VirtualMachine,
1961-
}
1962-
19631959
/// The general interface for the VM
19641960
///
19651961
/// # Examples
@@ -1976,6 +1972,10 @@ pub struct Interpreter {
19761972
/// vm.run_code_obj(code_obj, scope).unwrap();
19771973
/// });
19781974
/// ```
1975+
pub struct Interpreter {
1976+
vm: VirtualMachine,
1977+
}
1978+
19791979
impl Interpreter {
19801980
pub fn new(settings: PySettings, init: InitParameter) -> Self {
19811981
Self::new_with_init(settings, |_| init)

0 commit comments

Comments
 (0)