Skip to content

Commit ac545bf

Browse files
committed
Post-rebase update and a couple changes
1 parent 4f576a9 commit ac545bf

File tree

6 files changed

+18
-65
lines changed

6 files changed

+18
-65
lines changed

boa_temporal/Cargo.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ license.workspace = true
1111
repository.workspace = true
1212
rust-version.workspace = true
1313

14-
1514
[dependencies]
16-
icu_calendar = { version = "~1.3.2", default-features = false }
1715
tinystr = "0.7.4"
18-
bitflags.workspace = true
16+
icu_calendar = { workspace = true, default-features = false }
1917
rustc-hash = { workspace = true, features = ["std"] }
2018
num-bigint = { workspace = true, features = ["serde"] }
19+
bitflags.workspace = true
2120
num-traits.workspace = true
2221

23-
2422
[features]
2523
context = []
24+
25+
[lints]
26+
workspace = true

boa_temporal/src/fields.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{error::TemporalError, TemporalResult};
66

77
use bitflags::bitflags;
88
// use rustc_hash::FxHashSet;
9-
use tinystr::{TinyStr16, TinyStr4};
9+
use tinystr::{TinyStr16, TinyStr4 };
1010

1111
bitflags! {
1212
/// FieldMap maps the currently active fields on the `TemporalField`
@@ -46,13 +46,14 @@ bitflags! {
4646

4747
/// The post conversion field value.
4848
#[derive(Debug)]
49+
#[allow(variant_size_differences)]
4950
pub enum FieldValue {
5051
/// Designates the values as an integer.
5152
Integer(i32),
52-
/// Designates the value as a string.
53-
String(String),
5453
/// Designates that the value is undefined.
5554
Undefined,
55+
/// Designates the value as a string.
56+
String(String),
5657
}
5758

5859
/// The Conversion type of a field.
@@ -320,7 +321,7 @@ impl TemporalFields {
320321
let FieldValue::String(offset) = value else {
321322
return Err(TemporalError::r#type().with_message("offset must be string."));
322323
};
323-
self.offset = Some(offset.clone());
324+
self.offset = Some(offset.to_string());
324325
self.bit_map.set(FieldMap::OFFSET, true);
325326

326327
Ok(())
@@ -353,7 +354,7 @@ impl TemporalFields {
353354
let FieldValue::String(tz) = value else {
354355
return Err(TemporalError::r#type().with_message("tz must be string."));
355356
};
356-
self.time_zone = Some(tz.clone());
357+
self.time_zone = Some(tz.to_string());
357358
self.bit_map.set(FieldMap::TIME_ZONE, true);
358359
Ok(())
359360
}

boa_temporal/src/lib.rs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,6 @@
66
html_favicon_url = "https://raw.githubusercontent.com/boa-dev/boa/main/assets/logo.svg"
77
)]
88
#![cfg_attr(not(test), forbid(clippy::unwrap_used))]
9-
#![warn(
10-
// rustc lint groups https://doc.rust-lang.org/rustc/lints/groups.html
11-
warnings,
12-
future_incompatible,
13-
let_underscore,
14-
nonstandard_style,
15-
rust_2018_compatibility,
16-
rust_2018_idioms,
17-
rust_2021_compatibility,
18-
unused,
19-
20-
// rustc allowed-by-default lints https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
21-
missing_docs,
22-
macro_use_extern_crate,
23-
meta_variable_misuse,
24-
missing_abi,
25-
missing_copy_implementations,
26-
missing_debug_implementations,
27-
non_ascii_idents,
28-
noop_method_call,
29-
single_use_lifetimes,
30-
trivial_casts,
31-
trivial_numeric_casts,
32-
unreachable_pub,
33-
unsafe_op_in_unsafe_fn,
34-
unused_crate_dependencies,
35-
unused_import_braces,
36-
unused_lifetimes,
37-
unused_qualifications,
38-
unused_tuple_struct_fields,
39-
variant_size_differences,
40-
41-
// rustdoc lints https://doc.rust-lang.org/rustdoc/lints.html
42-
rustdoc::broken_intra_doc_links,
43-
rustdoc::private_intra_doc_links,
44-
rustdoc::missing_crate_level_docs,
45-
rustdoc::private_doc_tests,
46-
rustdoc::invalid_codeblock_attributes,
47-
rustdoc::invalid_rust_codeblocks,
48-
rustdoc::bare_urls,
49-
50-
// clippy allowed by default
51-
clippy::dbg_macro,
52-
53-
// clippy categories https://doc.rust-lang.org/clippy/
54-
clippy::all,
55-
clippy::correctness,
56-
clippy::suspicious,
57-
clippy::style,
58-
clippy::complexity,
59-
clippy::perf,
60-
clippy::pedantic,
61-
)]
629
#![allow(
6310
// Currently throws a false positive regarding dependencies that are only used in benchmarks.
6411
unused_crate_dependencies,

boa_temporal/src/time.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ use crate::iso::IsoTime;
44

55
/// The Temporal `PlainTime` object.
66
#[derive(Debug, Default, Clone, Copy)]
7+
#[allow(dead_code)]
78
pub struct TemporalTime {
89
iso: IsoTime,
910
}
1011

1112
// ==== Private API ====
1213

1314
impl TemporalTime {
15+
#[allow(dead_code)]
1416
pub(crate) fn new_unchecked(
1517
hour: i32,
1618
minute: i32,
@@ -25,6 +27,7 @@ impl TemporalTime {
2527
}
2628

2729
/// Checks if the time is a valid `TemporalTime`
30+
#[allow(dead_code)]
2831
pub(crate) fn is_valid(&self) -> bool {
2932
self.iso.is_valid()
3033
}

boa_temporal/src/utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ pub(crate) fn epoch_time_to_epoch_year(t: f64) -> i32 {
156156
// roughly calculate the largest possible year given the time t,
157157
// then check and refine the year.
158158
let day_count = epoch_time_to_day_number(t);
159-
let mut year = day_count / 365;
159+
let mut year = (day_count / 365) + 1970;
160160
loop {
161161
if epoch_time_for_year(year) <= t {
162162
break;
163163
}
164164
year -= 1;
165165
}
166166

167-
year + 1970
167+
year
168168
}
169169

170170
/// Returns either 1 (true) or 0 (false)

boa_temporal/src/zoneddatetime.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
//! The ZonedDateTime module.
1+
//! The `ZonedDateTime` module.
22
33
// NOTE: Mostly serves as a placeholder currently
44
// until the rest can be implemented.
55
/// `TemporalZoneDateTime`
6+
#[derive(Debug, Clone, Copy)]
67
pub struct TemporalZonedDateTime;

0 commit comments

Comments
 (0)