Skip to content

Commit

Permalink
deps: Upgrade to Rust v1.66 (#502)
Browse files Browse the repository at this point in the history
* Bump to 1.66.

* Fix lints.

* Update lock.

* Update lock.
  • Loading branch information
milesj committed Dec 19, 2022
1 parent e7bd899 commit 1f78b55
Show file tree
Hide file tree
Showing 28 changed files with 42 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# ref: ${{ github.event.pull_request.head.sha }}
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
toolchain: 1.66.0
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/moon.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
cache: yarn
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.65.0
toolchain: 1.66.0
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: 1.65.0
toolchain: 1.66.0
profile: minimal
components: rustfmt
- uses: Swatinem/rust-cache@v2
Expand All @@ -48,7 +48,7 @@ jobs:
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: 1.65.0
toolchain: 1.66.0
profile: minimal
components: clippy
- uses: Swatinem/rust-cache@v2
Expand All @@ -69,7 +69,7 @@ jobs:
- uses: actions-rs/toolchain@v1
name: Setup toolchain
with:
toolchain: 1.65.0
toolchain: 1.66.0
profile: minimal
components: llvm-tools-preview
- name: Cache cargo
Expand Down
6 changes: 3 additions & 3 deletions crates/cli/src/commands/init/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ pub async fn init(

// Create config files
fs::write(
&moon_dir.join(CONFIG_TOOLCHAIN_FILENAME),
moon_dir.join(CONFIG_TOOLCHAIN_FILENAME),
toolchain_configs
.into_iter()
.map(|c| c.trim().to_owned())
Expand All @@ -192,12 +192,12 @@ pub async fn init(
)?;

fs::write(
&moon_dir.join(CONFIG_WORKSPACE_FILENAME),
moon_dir.join(CONFIG_WORKSPACE_FILENAME),
render_workspace_template(&context)?,
)?;

fs::write(
&moon_dir.join(CONFIG_GLOBAL_PROJECT_FILENAME),
moon_dir.join(CONFIG_GLOBAL_PROJECT_FILENAME),
Tera::one_off(load_global_project_config_template(), &context, false)?,
)?;

Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/src/project/global_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl GlobalProjectConfig {
let profile_name = "globalProject";
let mut config = GlobalProjectConfig::default();

for source in gather_extended_sources(&path)? {
for source in gather_extended_sources(path)? {
let figment = Figment::from(YamlExtended::file(source).profile(profile_name));
let extended_config = GlobalProjectConfig::load_config(figment.select(profile_name))?;

Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/src/toolchain/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl ToolchainConfig {
let mut figment =
Figment::from(Serialized::defaults(ToolchainConfig::default()).profile(profile_name));

for source in gather_extended_sources(&path)? {
for source in gather_extended_sources(path)? {
figment = figment.merge(YamlExtended::file(source).profile(profile_name));
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/src/workspace/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl WorkspaceConfig {
let mut figment =
Figment::from(Serialized::defaults(WorkspaceConfig::default()).profile(profile_name));

for source in gather_extended_sources(&path)? {
for source in gather_extended_sources(path)? {
figment = figment.merge(YamlExtended::file(source).profile(profile_name));
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/src/workspace/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ mod tests {

fn load_jailed_config() -> Result<RunnerConfig, figment::Error> {
let figment = Figment::from(Serialized::defaults(RunnerConfig::default()))
.merge(YamlExtended::file(&PathBuf::from(CONFIG_FILENAME)));
.merge(YamlExtended::file(PathBuf::from(CONFIG_FILENAME)));
let config: RunnerConfig = figment.extract()?;

config
Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/tests/local_project_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::collections::BTreeMap;
use std::path::PathBuf;

fn load_jailed_config() -> Result<ProjectConfig, figment::Error> {
match ProjectConfig::load(&PathBuf::from(CONFIG_PROJECT_FILENAME)) {
match ProjectConfig::load(PathBuf::from(CONFIG_PROJECT_FILENAME)) {
Ok(cfg) => Ok(cfg),
Err(error) => Err(match error {
ConfigError::FailedValidation(errors) => errors.first().unwrap().to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/tests/tasks_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const CONFIG_FILENAME: &str = "tasks.yml";

// Not a config file, but we want to test in isolation
fn load_jailed_config() -> Result<TaskConfig, figment::Error> {
let figment = Figment::new().merge(YamlExtended::file(&PathBuf::from(CONFIG_FILENAME)));
let figment = Figment::new().merge(YamlExtended::file(PathBuf::from(CONFIG_FILENAME)));
let config: TaskConfig = figment.extract()?;

config
Expand Down
2 changes: 1 addition & 1 deletion crates/core/config/tests/template_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use moon_constants::CONFIG_TEMPLATE_FILENAME;
use std::path::PathBuf;

fn load_jailed_config() -> Result<TemplateConfig, figment::Error> {
match TemplateConfig::load(&PathBuf::from(CONFIG_TEMPLATE_FILENAME)) {
match TemplateConfig::load(PathBuf::from(CONFIG_TEMPLATE_FILENAME)) {
Ok(cfg) => Ok(cfg),
Err(error) => Err(match error {
ConfigError::FailedValidation(errors) => errors.first().unwrap().to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion crates/core/logger/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub fn url<T: AsRef<str>>(url: T) -> String {
}

pub fn shell<T: AsRef<str>>(cmd: T) -> String {
paint(Color::Pink as u8, &clean_path(cmd))
paint(Color::Pink as u8, clean_path(cmd))
}

pub fn symbol<T: AsRef<str>>(value: T) -> String {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/logger/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Logger {
"{}{} {}{}",
color::muted("["),
color::log_level(record.level()),
color::muted(&formatted_timestamp),
color::muted(formatted_timestamp),
color::muted("]"),
);

Expand Down
2 changes: 1 addition & 1 deletion crates/core/moon/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::path::Path;
use strum::IntoEnumIterator;

pub fn register_platforms(workspace: &mut Workspace) {
workspace.register_platform(Box::new(SystemPlatform::default()));
workspace.register_platform(Box::<SystemPlatform>::default());

if let Some(node_config) = &workspace.toolchain.config.node {
workspace.register_platform(Box::new(NodePlatform::new(node_config, &workspace.root)));
Expand Down
2 changes: 1 addition & 1 deletion crates/core/project/tests/project_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ mod tasks {

// Expanded
task.input_globs
.insert(glob::normalize(&workspace_root.join("tasks/no-tasks/**/*")).unwrap());
.insert(glob::normalize(workspace_root.join("tasks/no-tasks/**/*")).unwrap());

assert_eq!(
project,
Expand Down
6 changes: 3 additions & 3 deletions crates/core/runner/src/actions/run_target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ impl<'a> TargetRunner<'a> {

// Input globs are absolute paths, so we must do the same
hashed_file_tree
.retain(|k, _| globset.matches(&workspace.root.join(k)).unwrap_or(false));
.retain(|k, _| globset.matches(workspace.root.join(k)).unwrap_or(false));

hasher.hash_inputs(hashed_file_tree);
}
Expand All @@ -212,7 +212,7 @@ impl<'a> TargetRunner<'a> {
.filter(|f| {
// Deleted files will crash `git hash-object`
!local_files.deleted.contains(f)
&& globset.matches(&workspace.root.join(f)).unwrap_or(false)
&& globset.matches(workspace.root.join(f)).unwrap_or(false)
})
.collect::<Vec<String>>();

Expand Down Expand Up @@ -346,7 +346,7 @@ impl<'a> TargetRunner<'a> {

env_vars.insert(
"MOON_PROJECT_RUNFILE".to_owned(),
path::to_string(&runfile.path)?,
path::to_string(runfile.path)?,
);

Ok(env_vars)
Expand Down
2 changes: 1 addition & 1 deletion crates/core/runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl Runner {

let log_target_name =
format!("{}:batch:{}:{}", LOG_TARGET, batch_count, action_count);
let log_action_label = color::muted_light(&node.label());
let log_action_label = color::muted_light(node.label());

trace!(
target: &log_target_name,
Expand Down
2 changes: 1 addition & 1 deletion crates/core/task/tests/token_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ mod args {
resolver.resolve(&string_vec!["@in(0)"], &task).unwrap(),
(
vec![],
vec![glob::normalize(&project_root.join("src/**/*")).unwrap()]
vec![glob::normalize(project_root.join("src/**/*")).unwrap()]
)
);
}
Expand Down
2 changes: 1 addition & 1 deletion crates/core/utils/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn read_dir_all<T: AsRef<Path> + Send>(path: T) -> Result<Vec<fs::DirEntry>,
for entry in entries {
if let Ok(file_type) = entry.file_type() {
if file_type.is_dir() {
results.extend(read_dir_all(&entry.path())?);
results.extend(read_dir_all(entry.path())?);
} else {
results.push(entry);
}
Expand Down
1 change: 1 addition & 0 deletions crates/core/utils/src/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ fn is_program_on_path(program_name: String) -> bool {
};

for path_dir in env::split_paths(&system_path) {
#[allow(clippy::needless_borrow)]
if path_dir.join(&program_name).exists() {
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions crates/core/workspace/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn load_global_project_config(root_dir: &Path) -> Result<GlobalProjectConfig, Wo
trace!(
target: LOG_TARGET,
"Attempting to find {} in {}",
color::file(&format!(
color::file(format!(
"{}/{}",
constants::CONFIG_DIRNAME,
constants::CONFIG_GLOBAL_PROJECT_FILENAME,
Expand Down Expand Up @@ -79,7 +79,7 @@ fn load_toolchain_config(root_dir: &Path) -> Result<ToolchainConfig, WorkspaceEr
trace!(
target: LOG_TARGET,
"Loading {} from {}",
color::file(&format!(
color::file(format!(
"{}/{}",
constants::CONFIG_DIRNAME,
constants::CONFIG_TOOLCHAIN_FILENAME,
Expand Down Expand Up @@ -112,7 +112,7 @@ fn load_workspace_config(root_dir: &Path) -> Result<WorkspaceConfig, WorkspaceEr
trace!(
target: LOG_TARGET,
"Loading {} from {}",
color::file(&format!(
color::file(format!(
"{}/{}",
constants::CONFIG_DIRNAME,
constants::CONFIG_WORKSPACE_FILENAME,
Expand Down
2 changes: 1 addition & 1 deletion crates/node/lang/src/yarn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use yarn_lock_parser::{parse_str, Entry};
pub fn load_lockfile_dependencies(path: PathBuf) -> Result<LockfileDependencyVersions, MoonError> {
let mut deps: LockfileDependencyVersions = FxHashMap::default();

let yarn_lock_text = fs::read(&path)?;
let yarn_lock_text = fs::read(path)?;
let entries: Vec<Entry> = parse_str(&yarn_lock_text)
.map_err(|e| MoonError::Generic(format!("Failed to parse lockfile: {}", e)))?;

Expand Down
2 changes: 1 addition & 1 deletion crates/node/platform/src/actions/install_deps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn sync_workspace(workspace: &Workspace, node: &NodeTool) -> Result<(), MoonErro
let rc_name = version_manager.get_config_filename();
let rc_path = workspace.root.join(&rc_name);

fs::write(&rc_path, &node.config.version)?;
fs::write(rc_path, &node.config.version)?;

debug!(
target: LOG_TARGET,
Expand Down
4 changes: 2 additions & 2 deletions crates/node/platform/src/actions/sync_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub fn create_missing_tsconfig(

let json = TsConfigJson {
extends: Some(path::to_virtual_string(
path::relative_from(&tsconfig_options_path, &project.root).unwrap(),
path::relative_from(tsconfig_options_path, &project.root).unwrap(),
)?),
include: Some(string_vec!["**/*"]),
references: Some(vec![]),
Expand Down Expand Up @@ -293,7 +293,7 @@ pub async fn sync_project(

tsconfig_json.update_compiler_options().out_dir =
Some(path::to_virtual_string(
path::relative_from(&cache_route, &project.root).unwrap(),
path::relative_from(cache_route, &project.root).unwrap(),
)?);
}

Expand Down
6 changes: 3 additions & 3 deletions crates/typescript/lang/src/tsconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub fn load_to_value<T: AsRef<Path>>(path: T, extend: bool) -> Result<JsonValue,
if extend {
if let JsonValue::String(s) = &json["extends"] {
let extends_path = path.parent().unwrap_or_else(|| Path::new("")).join(s);
let extends_value = load_to_value(&extends_path, extend)?;
let extends_value = load_to_value(extends_path, extend)?;

merge(&mut json, extends_value);
}
Expand Down Expand Up @@ -934,7 +934,7 @@ mod test {
#[test]
fn parse_inheriting_file() {
let path = get_fixtures_path("base/tsconfig-json/tsconfig.inherits.json");
let config = TsConfigJson::load_with_extends(&path).unwrap();
let config = TsConfigJson::load_with_extends(path).unwrap();

assert_eq!(
config
Expand All @@ -959,7 +959,7 @@ mod test {
#[test]
fn parse_inheritance_chain() {
let path = get_fixtures_path("base/tsconfig-json/a/tsconfig.json");
let config = TsConfigJson::load_with_extends(&path).unwrap();
let config = TsConfigJson::load_with_extends(path).unwrap();

assert_eq!(
config
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
- Fixed an issue on Windows where `package.json` and `tsconfig.json` would change newlines
unexpectedly when saving.

#### ⚙️ Internal

- Updated Rust to v1.66.

## 0.20.3

#### 🐞 Fixes
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
# https://rust-lang.github.io/rustup/concepts/profiles.html
profile = "default"
channel = "1.65.0"
channel = "1.66.0"
2 changes: 1 addition & 1 deletion scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# glibc

FROM rust:1.65.0 AS base-gnu
FROM rust:1.66.0 AS base-gnu
RUN cargo install cargo-chef --version ^0.1
WORKDIR /app
COPY .cargo .cargo
Expand Down

0 comments on commit 1f78b55

Please sign in to comment.