Merge pull request #3516 from coolreader18/fix-ci

Fix doctests in ci
This commit is contained in:
Noa
2022-01-14 19:53:26 -06:00
committed by GitHub
11 changed files with 26 additions and 26 deletions

View File

@@ -71,7 +71,8 @@ opt-level = 3
[profile.test]
opt-level = 3
lto = "thin"
# https://github.com/rust-lang/rust/issues/92869
# lto = "thin"
[profile.bench]
lto = true

View File

@@ -465,7 +465,7 @@ pub struct Drain<'a, T> {
}
unsafe impl<'a, T: Sync> Sync for Drain<'a, T> {}
unsafe impl<'a, T: Send> Send for Drain<'a, T> {}
unsafe impl<'a, T: Sync> Send for Drain<'a, T> {}
impl<T> Iterator for Drain<'_, T> {
type Item = T;

View File

@@ -128,6 +128,9 @@ struct PointersInner<T> {
_pin: PhantomPinned,
}
unsafe impl<T: Send> Send for PointersInner<T> {}
unsafe impl<T: Sync> Sync for PointersInner<T> {}
unsafe impl<T: Send> Send for Pointers<T> {}
unsafe impl<T: Sync> Sync for Pointers<T> {}

View File

@@ -88,6 +88,7 @@ struct CompileContext {
}
#[derive(Debug, Clone, Copy, PartialEq)]
#[allow(clippy::enum_variant_names)]
enum FunctionContext {
NoFunction,
Function,

View File

@@ -102,9 +102,7 @@ impl ItemMetaInner {
Err(syn::Error::new_spanned(
ident,
format!(
"#[{}({})] is not one of allowed attributes [{}]",
meta_ident.to_string(),
name,
"#[{meta_ident}({name})] is not one of allowed attributes [{}]",
allowed_names.join(", ")
),
))
@@ -116,7 +114,7 @@ impl ItemMetaInner {
if !lits.is_empty() {
return Err(syn::Error::new_spanned(
&meta_ident,
format!("#[{}(..)] cannot contain literal", meta_ident.to_string()),
format!("#[{meta_ident}(..)] cannot contain literal"),
));
}
@@ -381,7 +379,7 @@ impl AttributeExt for Attribute {
other.span(),
format!(
"#[{name}(...)] doesn't contain '{item}' to remove",
name = other.get_ident().unwrap().to_string(),
name = other.get_ident().unwrap(),
item = item_name
),
)),

View File

@@ -286,6 +286,9 @@ impl UnTypedAbiValue {
}
}
// we don't actually ever touch CompiledCode til we drop it, it should be safe.
// TODO: confirm with wasmtime ppl that it's not unsound?
#[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl Send for CompiledCode {}
unsafe impl Sync for CompiledCode {}

View File

@@ -455,13 +455,13 @@ fn namereplace_errors(err: PyObjectRef, vm: &VirtualMachine) -> PyResult<(String
use std::fmt::Write;
let c_u32 = c as u32;
if let Some(c_name) = unicode_names2::name(c) {
write!(out, "\\N{{{}}}", c_name.to_string()).unwrap();
write!(out, "\\N{{{c_name}}}").unwrap();
} else if c_u32 >= 0x10000 {
write!(out, "\\U{:08x}", c_u32).unwrap();
write!(out, "\\U{c_u32:08x}").unwrap();
} else if c_u32 >= 0x100 {
write!(out, "\\u{:04x}", c_u32).unwrap();
write!(out, "\\u{c_u32:04x}").unwrap();
} else {
write!(out, "\\x{:02x}", c_u32).unwrap();
write!(out, "\\x{c_u32:02x}").unwrap();
}
}
Ok((out, range.end))

View File

@@ -144,7 +144,7 @@ impl VirtualMachine {
}?;
match offer_suggestions(exc, vm) {
Some(suggestions) => writeln!(output, ". Did you mean: '{}'?", suggestions.to_string()),
Some(suggestions) => writeln!(output, ". Did you mean: '{suggestions}'?"),
None => writeln!(output),
}
}

View File

@@ -413,11 +413,7 @@ impl FormatSpec {
},
};
if raw_magnitude_string_result.is_err() {
return raw_magnitude_string_result;
}
let magnitude_string = self.add_magnitude_separators(raw_magnitude_string_result.unwrap());
let magnitude_string = self.add_magnitude_separators(raw_magnitude_string_result?);
let format_sign = self.sign.unwrap_or(FormatSign::Minus);
let sign_str = if num.is_sign_negative() && !num.is_nan() {
"-"
@@ -474,13 +470,10 @@ impl FormatSpec {
},
None => Ok(magnitude.to_str_radix(10)),
};
if raw_magnitude_string_result.is_err() {
return raw_magnitude_string_result;
}
let magnitude_string = format!(
"{}{}",
prefix,
self.add_magnitude_separators(raw_magnitude_string_result.unwrap())
self.add_magnitude_separators(raw_magnitude_string_result?)
);
let format_sign = self.sign.unwrap_or(FormatSign::Minus);

View File

@@ -307,6 +307,7 @@ pub struct PyWeak {
cfg_if::cfg_if! {
if #[cfg(feature = "threading")] {
#[allow(clippy::non_send_fields_in_send_ty)] // false positive?
unsafe impl Send for PyWeak {}
unsafe impl Sync for PyWeak {}
}
@@ -819,7 +820,7 @@ fn print_del_error(e: PyBaseExceptionRef, zelf: &PyObject, vm: &VirtualMachine)
let del_method = zelf.get_class_attr("__del__").unwrap();
let repr = &del_method.repr(vm);
match repr {
Ok(v) => println!("{}", v.to_string()),
Ok(v) => println!("{v}"),
Err(_) => println!("{}", del_method.class().name()),
}
let tb_module = vm.import("traceback", None, 0).unwrap();

View File

@@ -1956,10 +1956,6 @@ impl<'vm> Drop for ReprGuard<'vm> {
}
}
pub struct Interpreter {
vm: VirtualMachine,
}
/// The general interface for the VM
///
/// # Examples
@@ -1976,6 +1972,10 @@ pub struct Interpreter {
/// vm.run_code_obj(code_obj, scope).unwrap();
/// });
/// ```
pub struct Interpreter {
vm: VirtualMachine,
}
impl Interpreter {
pub fn new(settings: PySettings, init: InitParameter) -> Self {
Self::new_with_init(settings, |_| init)