Fix all spelling mistakes in history by typos tool

This commit is contained in:
Cautreoxit
2024-08-26 15:31:58 +08:00
committed by Tate, Hongliang Tian
parent b29d3b5409
commit 86f09eef75
120 changed files with 255 additions and 213 deletions

View File

@ -80,9 +80,9 @@ pub fn new_base_crate(
// here when OSTD is ready
include_linker_script!(["x86_64.ld"]);
// Overrite the main.rs file
// Overwrite the main.rs file
let main_rs = include_str!("main.rs.template");
// Replace all occurence of `#TARGET_NAME#` with the `dep_crate_name`
// Replace all occurrence of `#TARGET_NAME#` with the `dep_crate_name`
let main_rs = main_rs.replace("#TARGET_NAME#", &dep_crate_name.replace('-', "_"));
fs::write("src/main.rs", main_rs).unwrap();
@ -104,10 +104,10 @@ fn add_manifest_dependency(
crate_path: impl AsRef<Path>,
link_unit_test_runner: bool,
) {
let mainfest_path = "Cargo.toml";
let manifest_path = "Cargo.toml";
let mut manifest: toml::Table = {
let content = fs::read_to_string(mainfest_path).unwrap();
let content = fs::read_to_string(manifest_path).unwrap();
toml::from_str(&content).unwrap()
};
@ -151,7 +151,7 @@ fn add_manifest_dependency(
}
let content = toml::to_string(&manifest).unwrap();
fs::write(mainfest_path, content).unwrap();
fs::write(manifest_path, content).unwrap();
}
fn copy_profile_configurations(workspace_root: impl AsRef<Path>) {

View File

@ -1,4 +1,4 @@
# This template file is used by the runner script to generate the acutal grub.cfg
# This template file is used by the runner script to generate the actual grub.cfg
# AUTOMATICALLY GENERATED FILE, DO NOT EDIT IF YOU KNOW WHAT YOU ARE DOING

View File

@ -113,7 +113,7 @@ fn generate_grub_cfg(
// Delete the first two lines that notes the file a template file.
let grub_cfg = grub_cfg.lines().skip(2).collect::<Vec<&str>>().join("\n");
// Set the timout style and timeout.
// Set the timeout style and timeout.
let grub_cfg = grub_cfg
.replace(
"#GRUB_TIMEOUT_STYLE#",

View File

@ -31,10 +31,10 @@ fn aster_rust_toolchain() -> String {
}
fn add_manifest_dependencies(cargo_metadata: &serde_json::Value, crate_name: &str) {
let mainfest_path = get_manifest_path(cargo_metadata, crate_name);
let manifest_path = get_manifest_path(cargo_metadata, crate_name);
let mut manifest: toml::Table = {
let content = fs::read_to_string(mainfest_path).unwrap();
let content = fs::read_to_string(manifest_path).unwrap();
toml::from_str(&content).unwrap()
};
@ -44,7 +44,7 @@ fn add_manifest_dependencies(cargo_metadata: &serde_json::Value, crate_name: &st
dependencies.as_table_mut().unwrap().extend(ostd_dep);
let content = toml::to_string(&manifest).unwrap();
fs::write(mainfest_path, content).unwrap();
fs::write(manifest_path, content).unwrap();
}
// Add `target/osdk/base` to `exclude` array of the workspace manifest

View File

@ -56,8 +56,8 @@ fn apply_args_before_finalize(action_scheme: &mut ActionScheme, args: &CommonArg
if let Some(ref mut boot) = action_scheme.boot {
apply_kv_array(&mut boot.kcmd_args, &args.kcmd_args, "=", &[]);
for init_arg in &args.init_args {
for seperated_arg in init_arg.split(' ') {
boot.init_args.push(seperated_arg.to_string());
for separated_arg in init_arg.split(' ') {
boot.init_args.push(separated_arg.to_string());
}
}
if let Some(initramfs) = &args.initramfs {

View File

@ -26,7 +26,7 @@ pub enum BootMethod {
/// Boot the kernel by making a Qcow2 image with Grub as the bootloader.
GrubQcow2,
/// Use the [QEMU direct boot](https://qemu-project.gitlab.io/qemu/system/linuxboot.html)
/// to boot the kernel with QEMU's built-in Seabios and Coreboot utilites.
/// to boot the kernel with QEMU's built-in Seabios and Coreboot utilities.
#[default]
QemuDirect,
}

View File

@ -18,7 +18,7 @@ pub use qemu::*;
pub struct Scheme {
// The user is not allowed to set this field. However,
// the manifest loader set this and all actions such
// as runnning, testing, and building will use this field.
// as running, testing, and building will use this field.
pub work_dir: Option<PathBuf>,
#[serde(default)]
pub supported_archs: Vec<Arch>,

View File

@ -45,11 +45,11 @@ pub fn split_to_kv_array(args: &str) -> Vec<String> {
pub fn apply_kv_array(
array: &mut Vec<String>,
args: &Vec<String>,
seperator: &str,
separator: &str,
multi_value_keys: &[&str],
) {
let multi_value_keys = {
let mut inferred_keys = infer_multi_value_keys(array, seperator);
let mut inferred_keys = infer_multi_value_keys(array, separator);
for key in multi_value_keys {
inferred_keys.insert(key.to_string());
}
@ -63,8 +63,8 @@ pub fn apply_kv_array(
let mut multi_value_key_strings: IndexMap<String, Vec<String>> = IndexMap::new();
for item in array.drain(..) {
// Each key-value string has two patterns:
// 1. Seperated by separator: key value / key=value
if let Some(key) = get_key(&item, seperator) {
// 1. Separated by separator: key value / key=value
if let Some(key) = get_key(&item, separator) {
if multi_value_keys.contains(&key) {
if let Some(v) = multi_value_key_strings.get_mut(&key) {
v.push(item);
@ -83,7 +83,7 @@ pub fn apply_kv_array(
}
for arg in args {
if let Some(key) = get_key(arg, seperator) {
if let Some(key) = get_key(arg, separator) {
if multi_value_keys.contains(&key) {
if let Some(v) = multi_value_key_strings.get_mut(&key) {
v.push(arg.to_owned());
@ -108,27 +108,27 @@ pub fn apply_kv_array(
}
}
fn infer_multi_value_keys(array: &Vec<String>, seperator: &str) -> IndexSet<String> {
fn infer_multi_value_keys(array: &Vec<String>, separator: &str) -> IndexSet<String> {
let mut multi_val_keys = IndexSet::new();
let mut occured_keys = IndexSet::new();
let mut occurred_keys = IndexSet::new();
for item in array {
let Some(key) = get_key(item, seperator) else {
let Some(key) = get_key(item, separator) else {
continue;
};
if occured_keys.contains(&key) {
if occurred_keys.contains(&key) {
multi_val_keys.insert(key);
} else {
occured_keys.insert(key);
occurred_keys.insert(key);
}
}
multi_val_keys
}
pub fn get_key(item: &str, seperator: &str) -> Option<String> {
let split = item.split(seperator).collect::<Vec<_>>();
pub fn get_key(item: &str, separator: &str) -> Option<String> {
let split = item.split(separator).collect::<Vec<_>>();
let len = split.len();
if len > 2 || len == 0 {
error_msg!("`{}` is an invalid argument.", item);