apply clippy changes

This commit is contained in:
lyken 2024-06-21 14:14:01 +08:00
parent d89146aa02
commit 06e9d90d57
7 changed files with 17 additions and 18 deletions

View File

@ -65,7 +65,7 @@ pub struct ArtiqCodeGenerator<'a> {
end: Option<Expr<Option<Type>>>,
timeline: &'a (dyn TimeFns + Sync),
/// The [ParallelMode] of the current parallel context.
/// The [`ParallelMode`] of the current parallel context.
///
/// The current parallel context refers to the nearest `with parallel` or `with legacy_parallel`
/// statement, which is used to determine when and how the timeline should be updated.

View File

@ -764,7 +764,7 @@ pub fn gen_call<'ctx, G: CodeGenerator>(
}
// default value handling
for k in keys {
if mapping.get(&k.name).is_some() {
if mapping.contains_key(&k.name) {
continue;
}
mapping.insert(

View File

@ -135,24 +135,23 @@ pub struct CodeGenContext<'ctx, 'a> {
/// The [Builder] instance for creating LLVM IR statements.
pub builder: Builder<'ctx>,
/// The [DebugInfoBuilder], [compilation unit information][DICompileUnit], and
/// The [`DebugInfoBuilder`], [compilation unit information][DICompileUnit], and
/// [scope information][DIScope] of this context.
pub debug_info: (DebugInfoBuilder<'ctx>, DICompileUnit<'ctx>, DIScope<'ctx>),
/// The module for which [this context][CodeGenContext] is generating into.
pub module: Module<'ctx>,
/// The [TopLevelContext] associated with [this context][CodeGenContext].
/// The [`TopLevelContext`] associated with [this context][CodeGenContext].
pub top_level: &'a TopLevelContext,
pub unifier: Unifier,
pub resolver: Arc<dyn SymbolResolver + Send + Sync>,
pub static_value_store: Arc<Mutex<StaticValueStore>>,
/// A [HashMap] containing the mapping between the names of variables currently in-scope and
/// A [`HashMap`] containing the mapping between the names of variables currently in-scope and
/// its value information.
pub var_assignment: HashMap<StrRef, VarValue<'ctx>>,
///
pub type_cache: HashMap<Type, BasicTypeEnum<'ctx>>,
pub primitives: PrimitiveStore,
pub calls: Arc<HashMap<CodeLocation, CallId>>,
@ -161,24 +160,24 @@ pub struct CodeGenContext<'ctx, 'a> {
/// Cache for constant strings.
pub const_strings: HashMap<String, BasicValueEnum<'ctx>>,
/// [BasicBlock] containing all `alloca` statements for the current function.
/// [`BasicBlock`] containing all `alloca` statements for the current function.
pub init_bb: BasicBlock<'ctx>,
pub exception_val: Option<PointerValue<'ctx>>,
/// The header and exit basic blocks of a loop in this context. See
/// https://llvm.org/docs/LoopTerminology.html for explanation of these terminology.
/// <https://llvm.org/docs/LoopTerminology.html> for explanation of these terminology.
pub loop_target: Option<(BasicBlock<'ctx>, BasicBlock<'ctx>)>,
/// The target [BasicBlock] to jump to when performing stack unwind.
/// The target [`BasicBlock`] to jump to when performing stack unwind.
pub unwind_target: Option<BasicBlock<'ctx>>,
/// The target [BasicBlock] to jump to before returning from the function.
/// The target [`BasicBlock`] to jump to before returning from the function.
///
/// If this field is [None] when generating a return from a function, `ret` with no argument can
/// be emitted.
pub return_target: Option<BasicBlock<'ctx>>,
/// The [PointerValue] containing the return value of the function.
/// The [`PointerValue`] containing the return value of the function.
pub return_buffer: Option<PointerValue<'ctx>>,
// outer catch clauses
@ -187,7 +186,7 @@ pub struct CodeGenContext<'ctx, 'a> {
/// Whether `sret` is needed for the first parameter of the function.
///
/// See [need_sret].
/// See [`need_sret`].
pub need_sret: bool,
/// The current source location.

View File

@ -296,10 +296,10 @@ pub trait StaticValue {
#[derive(Clone)]
pub enum ValueEnum<'ctx> {
/// [ValueEnum] representing a static value.
/// [`ValueEnum`] representing a static value.
Static(Arc<dyn StaticValue + Send + Sync>),
/// [ValueEnum] representing a dynamic value.
/// [`ValueEnum`] representing a dynamic value.
Dynamic(BasicValueEnum<'ctx>),
}

View File

@ -95,7 +95,7 @@ pub enum TopLevelDef {
Class {
/// Name for error messages and symbols.
name: StrRef,
/// Object ID used for [TypeEnum].
/// Object ID used for [`TypeEnum`].
object_id: DefinitionId,
/// type variables bounded to the class.
type_vars: Vec<Type>,

View File

@ -549,7 +549,7 @@ fn test_basic(source: &str, mapping: &HashMap<&str, &str>, virtuals: &[(&str, &s
let mut defined_identifiers: HashSet<_> = env.identifier_mapping.keys().copied().collect();
defined_identifiers.insert("virtual".into());
let mut inferencer = env.get_inferencer();
inferencer.defined_identifiers = defined_identifiers.clone();
inferencer.defined_identifiers.clone_from(&defined_identifiers);
let statements = parse_program(source, FileName::default()).unwrap();
let statements = statements
.into_iter()
@ -695,7 +695,7 @@ fn test_primitive_magic_methods(source: &str, mapping: &HashMap<&str, &str>) {
let mut defined_identifiers: HashSet<_> = env.identifier_mapping.keys().copied().collect();
defined_identifiers.insert("virtual".into());
let mut inferencer = env.get_inferencer();
inferencer.defined_identifiers = defined_identifiers.clone();
inferencer.defined_identifiers.clone_from(&defined_identifiers);
let statements = parse_program(source, FileName::default()).unwrap();
let statements = statements
.into_iter()

View File

@ -208,7 +208,7 @@ pub enum TypeEnum {
/// An object type.
TObj {
/// The [DefintionId] of this object type.
/// The [`DefinitionId`] of this object type.
obj_id: DefinitionId,
/// The fields present in this object type.