Skip to content

Commit

Permalink
Update MSRV to 1.80 (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk authored Dec 16, 2024
1 parent 48e0ef5 commit e4d901c
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 42 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/cargo_machete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Cargo Machete

on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize]

jobs:
cargo-machete:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Machete
run: cargo install cargo-machete --locked && cargo machete
7 changes: 6 additions & 1 deletion .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: Link checker

Expand Down
14 changes: 10 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Copied from https://github.com/rerun-io/rerun_template
on: [push, pull_request]
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: Rust

Expand All @@ -17,7 +22,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: 1.77.0
toolchain: 1.80.0
override: true

- name: Install packages (Linux)
Expand Down Expand Up @@ -102,9 +107,10 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.77.0
toolchain: 1.80.0
target: wasm32-unknown-unknown
override: true
components: clippy

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
Expand All @@ -129,6 +135,6 @@ jobs:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.77.0"
rust-version: "1.80.0"
log-level: warn
command: check
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1751,9 +1751,9 @@ checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36"

[[package]]
name = "url"
version = "2.5.0"
version = "2.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633"
checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c"
dependencies = [
"form_urlencoded",
"idna",
Expand Down
20 changes: 15 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ license = "MIT OR Apache-2.0"
name = "egui_tiles"
readme = "README.md"
repository = "https://github.com/rerun-io/egui_tiles"
rust-version = "1.77"
rust-version = "1.80"
version = "0.10.1"

[package.metadata.docs.rs]
Expand Down Expand Up @@ -72,13 +72,13 @@ workspace = true
unsafe_code = "deny"

elided_lifetimes_in_paths = "warn"
future_incompatible = "warn"
nonstandard_style = "warn"
rust_2018_idioms = "warn"
future_incompatible = { level = "warn", priority = -1 }
nonstandard_style = { level = "warn", priority = -1 }
rust_2018_idioms = { level = "warn", priority = -1 }
rust_2021_prelude_collisions = "warn"
semicolon_in_expressions_from_macros = "warn"
trivial_numeric_casts = "warn"
unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
unsafe_op_in_unsafe_fn = "warn" # `unsafe_op_in_unsafe_fn` may become the default in future Rust versions: https://github.com/rust-lang/rust/issues/71668
unused_extern_crates = "warn"
unused_import_braces = "warn"
unused_lifetimes = "warn"
Expand Down Expand Up @@ -110,6 +110,7 @@ disallowed_types = "warn" # See clippy.toml
doc_link_with_quotes = "warn"
doc_markdown = "warn"
empty_enum = "warn"
empty_enum_variants_with_brackets = "warn"
enum_glob_use = "warn"
equatable_if_let = "warn"
exit = "warn"
Expand All @@ -133,6 +134,8 @@ inefficient_to_string = "warn"
infinite_loop = "warn"
into_iter_without_iter = "warn"
invalid_upcast_comparisons = "warn"
iter_filter_is_ok = "warn"
iter_filter_is_some = "warn"
iter_not_returning_iterator = "warn"
iter_on_empty_collections = "warn"
iter_on_single_items = "warn"
Expand All @@ -143,6 +146,7 @@ large_include_file = "warn"
large_stack_arrays = "warn"
large_stack_frames = "warn"
large_types_passed_by_value = "warn"
let_underscore_must_use = "warn"
let_underscore_untyped = "warn"
let_unit_value = "warn"
linkedlist = "warn"
Expand All @@ -151,6 +155,7 @@ macro_use_imports = "warn"
manual_assert = "warn"
manual_clamp = "warn"
manual_instant_elapsed = "warn"
manual_is_variant_and = "warn"
manual_let_else = "warn"
manual_ok_or = "warn"
manual_string_new = "warn"
Expand All @@ -169,6 +174,7 @@ missing_assert_message = "warn"
missing_enforced_import_renames = "warn"
missing_errors_doc = "warn"
missing_safety_doc = "warn"
mixed_attributes_style = "warn"
mut_mut = "warn"
mutex_integer = "warn"
needless_borrow = "warn"
Expand All @@ -178,21 +184,25 @@ needless_pass_by_ref_mut = "warn"
needless_pass_by_value = "warn"
negative_feature_names = "warn"
nonstandard_macro_braces = "warn"
option_as_ref_cloned = "warn"
option_option = "warn"
path_buf_push_overwrite = "warn"
ptr_as_ptr = "warn"
ptr_cast_constness = "warn"
pub_underscore_fields = "warn"
pub_without_shorthand = "warn"
rc_mutex = "warn"
readonly_write_lock = "warn"
redundant_type_annotations = "warn"
ref_as_ptr = "warn"
ref_option_ref = "warn"
rest_pat_in_fully_bound_structs = "warn"
same_functions_in_if_condition = "warn"
semicolon_if_nothing_returned = "warn"
should_panic_without_expect = "warn"
significant_drop_tightening = "warn"
single_match_else = "warn"
str_split_at_newline = "warn"
str_to_string = "warn"
string_add = "warn"
string_add_assign = "warn"
Expand Down
6 changes: 2 additions & 4 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# Release Checklist

* [ ] Update `CHANGELOG.md` using `./scripts/generate_changelog.py --commit-range 0.x.y..HEAD`
* [ ] Bump version numbers
* [ ] Update `CHANGELOG.md` using `./scripts/generate_changelog.py --version 0.NEW.VERSION`
* [ ] Bump version numbers in `Cargo.toml` and run `cargo check`.
* [ ] `git commit -m 'Release 0.x.0 - summary'`
* [ ] `cargo publish --quiet -p egui_tiles`
* [ ] `git tag -a 0.x.0 -m 'Release 0.x.0 - summary'`
* [ ] `git pull --tags && git tag -d latest && git tag -a latest -m 'Latest release' && git push --tags origin latest --force && git push origin main ; git push --tags`
* [ ] Do a GitHub release: https://github.com/rerun-io/egui_tiles/releases/new
* [ ] Wait for documentation to build: https://docs.rs/releases/queue
* [ ] Post on Twitter
2 changes: 1 addition & 1 deletion clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# -----------------------------------------------------------------------------
# Section identical to scripts/clippy_wasm/clippy.toml:

msrv = "1.77"
msrv = "1.80"

allow-unwrap-in-tests = true

Expand Down
1 change: 1 addition & 0 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ allow = [
"MPL-2.0", # https://www.mozilla.org/en-US/MPL/2.0/FAQ/ - see Q11. Used by webpki-roots on Linux.
"OFL-1.1", # https://spdx.org/licenses/OFL-1.1.html
"OpenSSL", # https://www.openssl.org/source/license.html - used on Linux
"Unicode-3.0", # https://www.unicode.org/license.txt
"Unicode-DFS-2016", # https://spdx.org/licenses/Unicode-DFS-2016.html
"Zlib", # https://tldrlegal.com/license/zlib-libpng-license-(zlib)
]
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Pane {
Self { nr }
}

pub fn ui(&mut self, ui: &mut egui::Ui) -> egui_tiles::UiResponse {
pub fn ui(&self, ui: &mut egui::Ui) -> egui_tiles::UiResponse {
let color = egui::epaint::Hsva::new(0.103 * self.nr as f32, 0.5, 0.5, 1.0);
ui.painter().rect_filled(ui.max_rect(), 0.0, color);
let dragged = ui
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
# to the user in the error, instead of "error: invalid channel name '[toolchain]'".

[toolchain]
channel = "1.77.0"
channel = "1.80" # Avoid specifying a patch version here; see https://github.com/emilk/eframe_template/issues/145
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]
2 changes: 1 addition & 1 deletion scripts/clippy_wasm/clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# -----------------------------------------------------------------------------
# Section identical to the main clippy.toml:

msrv = "1.77"
msrv = "1.80"

allow-unwrap-in-tests = true

Expand Down
61 changes: 45 additions & 16 deletions scripts/generate_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import re
import sys
from dataclasses import dataclass
from datetime import date
from typing import Any, Optional

import requests
Expand All @@ -25,15 +26,6 @@
OWNER = "rerun-io"
REPO = "egui_tiles"
INCLUDE_LABELS = False # It adds quite a bit of visual noise
OFFICIAL_RERUN_DEVS = [
"abey79",
"emilk",
"jleibs",
"jprochazk",
"nikolausWest",
"teh-cmc",
"Wumpf",
]


@dataclass
Expand Down Expand Up @@ -96,11 +88,18 @@ def fetch_pr_info(pr_number: int) -> Optional[PrInfo]:


def get_commit_info(commit: Any) -> CommitInfo:
match = re.match(r"(.*) \(#(\d+)\)", commit.summary)
if match:
# Squash-merge commits:
if match := re.match(r"(.*) \(#(\d+)\)", commit.summary):
title = str(match.group(1))
pr_number = int(match.group(2))
return CommitInfo(hexsha=commit.hexsha, title=title, pr_number=pr_number)

# Normal merge commits:
elif match := re.match(r"Merge pull request #(\d+) from (.*)", commit.summary):
title = str(match.group(2))
pr_number = int(match.group(1))
return CommitInfo(hexsha=commit.hexsha, title=title, pr_number=pr_number)

else:
return CommitInfo(hexsha=commit.hexsha, title=commit.summary, pr_number=None)

Expand All @@ -119,13 +118,43 @@ def print_section(crate: str, items: list[str]) -> None:
print()


def calc_commit_range(new_version: str) -> str:
parts = new_version.split(".")
assert len(parts) == 3, "Expected version to be on the format X.Y.Z"
major = int(parts[0])
minor = int(parts[1])
patch = int(parts[2])

if 0 < patch:
# A patch release.
# Include changes since last patch release.
# This assumes we've cherry-picked stuff for this release.
diff_since_version = f"0.{minor}.{patch - 1}"
elif 0 < minor:
# A minor release
# The diff should span everything since the last minor release.
# The script later excludes duplicated automatically, so we don't include stuff that
# was part of intervening patch releases.
diff_since_version = f"{major}.{minor - 1}.0"
else:
# A major release
# The diff should span everything since the last major release.
# The script later excludes duplicated automatically, so we don't include stuff that
# was part of intervening minor/patch releases.
diff_since_version = f"{major - 1}.{minor}.0"

return f"{diff_since_version}..HEAD"


def main() -> None:
parser = argparse.ArgumentParser(description="Generate a changelog.")
parser.add_argument("--commit-range", help="e.g. 0.1.0..HEAD", required=True)
parser.add_argument("--version", required=True, help="The version of the new release, e.g. 0.42.0")
args = parser.parse_args()

commit_range = calc_commit_range(args.version)

repo = Repo(".")
commits = list(repo.iter_commits(args.commit_range))
commits = list(repo.iter_commits(commit_range))
commits.reverse() # Most recent last
commit_infos = list(map(get_commit_info, commits))

Expand Down Expand Up @@ -169,8 +198,7 @@ def main() -> None:

if pr_info is not None:
gh_user_name = pr_info.gh_user_name
if gh_user_name not in OFFICIAL_RERUN_DEVS:
summary += f" (thanks [@{gh_user_name}](https://github.com/{gh_user_name})!)"
summary += f" by [@{gh_user_name}](https://github.com/{gh_user_name})"

prs.append(summary)

Expand All @@ -180,8 +208,9 @@ def main() -> None:
line = line[0].upper() + line[1:] # Upper-case first letter
prs[i] = line

print(f"## {args.version} - {date.today()}")
print()
print(f"Full diff at https://github.com/rerun-io/{REPO}/compare/{args.commit_range}")
print(f"Full diff at https://github.com/{OWNER}/{REPO}/compare/{commit_range}")
print()
print_section("PRs", prs)
print_section("Unsorted commits", unsorted_commits)
Expand Down
4 changes: 3 additions & 1 deletion scripts/template_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

# Files required by Rust, but not by _both_ C++ and Python
RUST_FILES = {
".github/workflows/cargo_machete.yml",
".github/workflows/rust.yml",
"bacon.toml",
"Cargo.lock",
Expand All @@ -67,6 +68,7 @@
"clippy.toml",
"Cranky.toml",
"deny.toml",
"RELEASES.md",
"rust-toolchain",
"scripts/clippy_wasm/",
"scripts/clippy_wasm/clippy.toml",
Expand Down Expand Up @@ -105,7 +107,7 @@ def init(languages: set[str], dry_run: bool) -> None:
delete_files_and_folder(files_to_delete, dry_run)


def remove_file(filepath: str):
def remove_file(filepath: str) -> None:
try:
os.remove(filepath)
except FileNotFoundError:
Expand Down
6 changes: 3 additions & 3 deletions src/container/linear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl Linear {
}
}

fn visible_children<Pane>(&mut self, tiles: &Tiles<Pane>) -> Vec<TileId> {
fn visible_children<Pane>(&self, tiles: &Tiles<Pane>) -> Vec<TileId> {
self.children
.iter()
.copied()
Expand Down Expand Up @@ -168,7 +168,7 @@ impl Linear {
}

fn layout_horizontal<Pane>(
&mut self,
&self,
tiles: &mut Tiles<Pane>,
style: &egui::Style,
behavior: &mut dyn Behavior<Pane>,
Expand All @@ -192,7 +192,7 @@ impl Linear {
}

fn layout_vertical<Pane>(
&mut self,
&self,
tiles: &mut Tiles<Pane>,
style: &egui::Style,
behavior: &mut dyn Behavior<Pane>,
Expand Down
Loading

0 comments on commit e4d901c

Please sign in to comment.